n = int(input()) a = list(map(int, input().split())) current = {(0, 0)} # (U, L) for ai in a: next_set = set() # Process addition for (U, L) in current: total = L + ai new_U = U + (total // 1024) new_L = total % 1024 next_set.add((new_U, new_L)) # Process AND for (U, L) in current: new_L = L & ai next_set.add((0, new_L)) print(len(next_set)) current = next_set