#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
const int mod = 1e9 + 7;
int dcmp(long double x, long double y) {
  return fabs(x - y) <= 1e-12 ? 0 : x < y ? -1 : 1;
}
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
int n;
int a[10 * 100 * 100 + 5];
int nxt[10 * 100 * 100 + 5][22];
set<int> ans;
int main() {
  fast();
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    ans.insert(a[i]);
  }
  for (int i = 0; i < 21; i++) {
    nxt[n][i] = -1;
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int k = 0; k < 21; k++) {
      nxt[i][k] = nxt[i + 1][k];
      if (a[i] & (1 << k)) nxt[i][k] = i;
    }
  }
  for (int i = 0; i < n; i++) {
    vector<pair<int, int> > v;
    for (int k = 0; k < 21; k++) {
      if (a[i] & (1 << k) || nxt[i][k] == -1) continue;
      v.push_back({nxt[i][k], k});
    }
    sort(v.begin(), v.end());
    for (int k = 0; k < v.size(); k++) {
      a[i] |= (1 << v[k].second);
      if (k == v.size() - 1 || v[k].first != v[k + 1].first) ans.insert(a[i]);
    }
  }
  cout << ans.size() << '\n';
  return 0;
}
