#include <bits/stdc++.h>
using namespace std;
set<int> cnt;
int n, a[100005];
int one[22];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    int a;
    scanf("%d", &a);
    vector<pair<int, int> > v;
    int x = 0;
    for (int j = 0; j < 20; ++j)
      if (!(a >> j & 1)) {
        v.push_back(make_pair(one[j], j));
      } else
        x |= (1 << j), one[j] = i;
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    cnt.insert(x);
    for (int j = 0; j < v.size(); ++j) {
      if (v[j].first == 0) break;
      x |= (1 << v[j].second);
      while (j + 1 < v.size() && v[j + 1].first == v[j].first) {
        x |= (1 << v[j + 1].second);
        j++;
      }
      cnt.insert(x);
    }
  }
  printf("%d", (int)cnt.size());
}
