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*.
#include<bits/stdc++.h>
using namespace std;
#define fore(i, l, r) for(int i = (l); i < (r); ++i)
#define forn(i, n) fore(i, 0, n)
#define fori(i, l, r) fore(i, l, (r) + 1)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define mp make_pair
#define max1 1000000007
typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;
int main()
{
    iostream::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    li n;
    cin>>n;
    set<int>s1,s2;
    li a[n];
    forn(i,n)
        cin>>a[i];
    vector<int>v;
    forn(i,n)
    {
        s1.insert(a[i]);
        s2.insert(a[i]);
        set<int>::iterator it;
        for(it=s1.begin();it!=s1.end();it++)
        {
            v.pb(a[i]|(*it));
            s2.insert(a[i]|(*it));
        }
        s1.clear();
        forn(i,v.size())
        {
            s1.insert(v[i]);
        }
        v.clear();
    }
    cout<<s2.size();
}
