## https://yukicoder.me/problems/no/1443 def main(): N = int(input()) A = list(map(int, input().split())) maxa = max(A) k = 0 while (1 << k) <= maxa: k += 1 dp = [0] * (1 << k) a_set = {0} answer = [0] * N for i in range(N): a = A[i] new_dp = [0] * (1 << k) new_a_set = set() for x in a_set: b = x & a new_a_set.add(b) c = x + a if c < (1 << k): new_a_set.add(c) else: new_dp[c % (1 << k)] += 1 for x in range(1 << k): if dp[x] > 0: b = x & a new_a_set.add(b) c = (x + a) % (1 << k) new_dp[c] += dp[x] a_set = new_a_set dp = new_dp answer[i] = sum(dp) + len(a_set) for i in range(N): print(answer[i]) if __name__ == "__main__": main()