#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 9;
const int MAXV = 1 << 20;
const int MAXB = 20;
bool flag[MAXV];
int pos[MAXB];
bool cmp(pair<int, int> prev, pair<int, int> next) {
  return prev.second > next.second;
}
int main() {
  int n, rx, x, ans;
  vector<pair<int, int> > v;
  memset(pos, -1, sizeof(pos));
  ans = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &rx);
    flag[rx] = true;
    x = rx;
    for (int j = 0; j < v.size(); ++j) {
      x |= 1 << v[j].first;
      if (j + 1 == v.size() || v[j].second != v[j + 1].second) flag[x] = true;
    }
    v.clear();
    for (int j = 0; j < MAXB; ++j) {
      if (rx & (1 << j)) pos[j] = i;
      if (pos[j] != -1) v.push_back(make_pair(j, pos[j]));
    }
    sort(v.begin(), v.end(), cmp);
  }
  for (int i = 0; i < MAXV; ++i) {
    if (flag[i]) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
