Niebieskie ksi.eczki
III Olympiad in Informatics 1995/1996

Task: NIE
Author: Wojciech Rytter
Knights

III stage contest  

A knight attacks squares on the chess-board as is show in figure 1.

rysunek objaśniający, jak atakuje skoczek szachowy
Figure 1: A knight on the square S attacks squares x.

There is a chess-board of dimensions 3 * n, with 3 rows and n columns, where 1 <= n <= 100, and there is a set Z of fields on the chess-board. The rows are numbered from the top to the bottom with numbers from 1 to 3, the columns from the left to the right with numbers from 1 to n.

Knights can be put only on the squares from the set Z and no two of them can attack each other.

We assume that in each column at most one field belongs to the set Z. Thus the set Z may be described with a series: k1, k2, ... , kn, where ki belongs to {0, 1, 2, 3}. If ki = 0 then no field in the i-th column belongs to the set Z, else ki is a number of a row of the only field in this column, which belongs to Z.

Task

Write a program that:

Input

In the first line of the text file NIE.IN there is written one positive integer n<=100. This is the number of columns in the chess-board. In each of the following n lines there is written one number form the set {0, 1, 2, 3}. These are the consecutive terms of the series describing the set Z.

Output

In the text file NIE.OUT  two integers M and L separated by a single space should be written.

Example

For the input file NIE.IN:
2
1
0
 
the correct answer is the output file NIE.OUT:
4 2

Your program should look for the file NIE.IN in the current directory and produce the output file NIE.OUT in the current directory too. The file containing the source code of your program should have a name NIE.???, whereas you should put three-letter abbreviation of the used programming language name instead of ???. The same program in executable form should be written in file NIE.EXE