n = int(input()) a_list = list(map(int, input().split())) s1 = set() s2 = set() s1.add(1) for a in a_list: new_s1 = set() new_s2 = set() # Process elements from s1 for x in s1: # Multiply option product = x * a if product >= 1024: new_s2.add(product % 1024) else: new_s1.add(product) # AND option new_and = x & a new_s1.add(new_and) # Process elements from s2 for a_prev in s2: # Multiply option if a == 0: new_s1.add(0) else: product_mod = (a_prev * a) % 1024 new_s2.add(product_mod) # AND option new_and = a_prev & a new_s1.add(new_and) # Update s1 and s2 for the next iteration s1 = new_s1 s2 = new_s2 # Output the current count print(len(s1) + len(s2))