N = int(input()) A = list(map(int, input().split())) current_states = set() current_states.add((False, 1)) # Initial state: X=1 (low, lower 10 bits are 1) for a in A: next_states = set() for (h, l) in current_states: # Multiply operation if a == 0: new_h = False new_l = 0 next_states.add((new_h, new_l)) else: if h: new_h = True new_l = (l * a) % 1024 next_states.add((new_h, new_l)) else: product = l * a if product >= 1024: new_h = True new_l = product % 1024 else: new_h = False new_l = product next_states.add((new_h, new_l)) # AND operation new_l_and = l & a next_states.add((False, new_l_and)) current_states = next_states print(len(current_states))