Classical Hard Game Problem

Time limit: 1s Memory limit: 256MB Input: Output:

Mr. COACH 1\mathbb{Mr. \ COACH \ 1} and Mr. COACH 2\mathbb{Mr. \ COACH \ 2} are playing a game.

They start from a set of nn distinct positive integers. The coaches take turns. In one move a coach chooses two distinct integers aa and bb from the set such that the set does not contain
|aba - b| and then add |aba - b| to the set. If one of the coaches cannot make any valid move he loses.

You need to find which coach will win. Mr. COACH 1\mathbb{Mr. \ COACH \ 1} makes the first move.

Input

The first line contains a single integer nn (2n1032 \le n \le 10^3) – the length of the initial set ss.
The second line contains nn distinct positive integers s1,s2,,sns_1, s_2, \ldots, s_n (0<si1090 < s_i \le 10^9).

Output

Print 1 if Mr. COACH 1\mathbb{Mr. \ COACH \ 1} wins or 2 if Mr. COACH 2\mathbb{Mr. \ COACH \ 2} wins.

Example 1

stdin

2
3 2

stdout

1

Example 2

stdin

2
3 5

stdout

1

Example 3

stdin

3
7 5 6

stdout

2

Log in or sign up to be able to send submissions!