Codeforces Round #366 (Div. 2)B

来源:互联网 发布:普通电视怎么连接网络 编辑:程序博客网 时间:2024/04/30 13:33
B. Spider Man
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Peter Parker wants to play a game with Dr. Octopus. The game is about cycles. Cycle is a sequence of vertices, such that first one is connected with the second, second is connected with third and so on, while the last one is connected with the first one again. Cycle may consist of a single isolated vertex.

Initially there are k cycles, i-th of them consisting of exactly vi vertices. Players play alternatively. Peter goes first. On each turn a player must choose a cycle with at least 2 vertices (for example, x vertices) among all available cycles and replace it by two cycles with p andx - p vertices where 1 ≤ p < x is chosen by the player. The player who cannot make a move loses the game (and his life!).

Peter wants to test some configurations of initial cycle sets before he actually plays with Dr. Octopus. Initially he has an empty set. In thei-th test he adds a cycle with ai vertices to the set (this is actually a multiset because it can contain two or more identical cycles). After each test, Peter wants to know that if the players begin the game with the current set of cycles, who wins?

Peter is pretty good at math, but now he asks you to help.

Input

The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of tests Peter is about to make.

The second line contains n space separated integers a1, a2, ..., an (1 ≤ ai ≤ 109), i-th of them stands for the number of vertices in the cycle added before the i-th test.

Output

Print the result of all tests in order they are performed. Print 1 if the player who moves first wins or 2 otherwise.

Examples
input
31 2 3
output
211
input
51 1 5 1 1
output
22222
两个人轮流拆分数字,直到数字不能拆分为止,最后一个拆分的胜利,每次拆分都是连续的
#include<cstdio>  using namespace std;    int main(){      int n,a;scanf("%d",&n);      long long s=0;      while (n--){          scanf ("%d",&a);          s+=a-1;          if (s&1)          printf ("1\n");          else          printf ("2\n");      }      return 0;        } 


0 0