Polycarpus has a sequence, consisting of *n* non-negative integers: *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub>.

Let's define function *f*(*l*, *r*) (*l*, *r* are integer, 1 ≤ *l* ≤ *r* ≤ *n*) for sequence *a* as an operation of bitwise OR of all the sequence elements with indexes from *l* to *r*. Formally: *f*(*l*, *r*) = *a*<sub class="lower-index">*l*</sub> | *a*<sub class="lower-index">*l* + 1</sub> | ...  | *a*<sub class="lower-index">*r*</sub>. 

Polycarpus took a piece of paper and wrote out the values of function *f*(*l*, *r*) for all *l*, *r* (*l*, *r* are integer, 1 ≤ *l* ≤ *r* ≤ *n*). Now he wants to know, how many distinct values he's got in the end. 

Help Polycarpus, count the number of distinct values of function *f*(*l*, *r*) for the given sequence *a*.

Expression *x* | *y* means applying the operation of bitwise OR to numbers *x* and *y*. This operation exists in all modern programming languages, for example, in language C++ and Java it is marked as "|", in Pascal — as "or".
The first line contains integer *n* (1 ≤ *n* ≤ 10<sup class="upper-index">5</sup>) — the number of elements of sequence *a*. The second line contains *n* space-separated integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (0 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">6</sup>) — the elements of sequence *a*.
import sys, math,os
from io import BytesIO, IOBase
#from bisect import bisect_left as bl, bisect_right as br, insort
#from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter
#from itertools import permutations,combinations
def data(): return sys.stdin.readline().strip()
def mdata(): return list(map(int, data().split()))
def outl(var) : sys.stdout.write(' '.join(map(str, var))+'\n')
def out(var) : sys.stdout.write(str(var)+'\n')
sys.setrecursionlimit(100000)
INF = float('inf')
mod = int(1e9)+7

def main():

    n=int(data())
    A=mdata()
    s=set()
    ans=set()
    for i in A:
        s=set(i|j for j in s)
        s.add(i)
        ans.update(s)
    print(len(ans))


if __name__ == '__main__':
    main()