#include <bits/stdc++.h>
using namespace std;
vector<int> a[23];
int g[100010];
int seen[2 * 1000000 + 100];
int main() {
  int N;
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    int x;
    scanf("%d", &x);
    g[i] = x;
    for (int j = 0; j < 23; j++)
      if (x & (1 << j)) {
        a[j].push_back(i);
      }
  }
  for (int i = 0; i < N; i++) {
    int x = g[i];
    seen[x] = true;
    vector<pair<int, int> > T;
    for (int j = 0; j < 23; j++) {
      if (x & (1 << j))
        ;
      else {
        vector<int>::iterator it = upper_bound(a[j].begin(), a[j].end(), i);
        if (it != a[j].end()) {
          T.push_back(make_pair(*it, j));
        }
      }
    }
    if (T.size() == 0) continue;
    sort(T.begin(), T.end());
    x |= (1 << T[0].second);
    for (int j = 1; j < T.size(); j++) {
      if (T[j].first == T[j - 1].first) {
        x |= (1 << T[j].second);
      } else {
        seen[x] = true;
        x |= (1 << T[j].second);
      }
    }
    seen[x] = true;
  }
  int rr = 0;
  for (int j = 0; j < 2000000; j++)
    if (seen[j]) {
      rr++;
    }
  printf("%d\n", rr);
  return 0;
}
