using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static long[] NList => ReadLine().Split().Select(long.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var g = new int[64]; for (var i = 0; i < g.Length; ++i) { var set = new HashSet(); for (var j = 0; j < 31; ++j) { if ((i & (1 << j)) != 0) set.Add(g[j]); } var tmp = 0; while (set.Contains(tmp)) ++tmp; g[i] = tmp; } var n = NN; var a = NList; var x = 0; foreach (var ai in a) { if (ai < 0) x ^= 1024; else { var set = new HashSet(); for (var j = 0; j < 61; ++j) { if ((ai & (1L << j)) != 0) set.Add(g[j]); } var tmp = 0; while (set.Contains(tmp)) ++tmp; x ^= tmp; } } WriteLine(x == 0 ? 2 : 1); } }