Instructions should be divided by new line

Example input:

4 
4 
2
2
1
4
1
3
2
3
2
4
1
0