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; WriteLine(Andd(n, a)); } static string Andd(int n, int[] a) { 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 (dp[j] > 0) { if (j * a[i] < 1024) ndp[j * a[i]] |= dp[j]; else ndp[j * a[i] % 1024 + 1024] += dp[j]; } if (a[i] != 0 && dp[j + 1024] > 0) ndp[j * a[i] % 1024 + 1024] += dp[j + 1024]; } dp = ndp; ans[i] = dp.Sum(); } return string.Join("\n", ans); } }