using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); static string[] SList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => ReadLine()).ToArray(); public static void Main() { Solve(); } static void Solve() { var n = NN; var a = NList; var dp = new int[2048]; dp[1] = 1; var ans = new int[n]; for (var i = 0; i < n; ++i) { var ndp = new int[2048]; for (var j = 0; j < 1024; ++j) { if (dp[j] > 0 || dp[j + 1024] > 0) ndp[j & a[i]] = 1; if (j * a[i] < 2048) ndp[j * a[i]] |= dp[j]; else ndp[j * a[i] % 1024 + 1024] += dp[j]; if (a[i] != 0) ndp[(j - 1024) * a[i] % 1024 + 1024] += dp[j + 1024]; } dp = ndp; ans[i] = dp.Sum(); } WriteLine(string.Join("\n", ans)); } }