#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
int n;
int data[maxn];
int f[25][maxn];
bool mark[(1 << 25)], tt;
int res = 0, p;
int tmp;
int tm, tp;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> data[i];
  memset(mark, 0, sizeof(mark));
  for (int k = 0; k <= 20; k++) {
    p = -1;
    for (int i = n; i >= 1; i--) {
      if ((data[i] & (1 << k)) == 0) {
        if (p == -1) {
          p = i;
        }
        f[k][i] = p;
      } else
        p = -1;
    }
  }
  for (int i = 1; i <= n; i++) {
    tmp = data[i];
    if (!mark[tmp]) {
      mark[tmp] = 1;
      res++;
    }
    p = i;
    while (p <= n) {
      tm = n + 1;
      for (int k = 0; k <= 20; k++)
        if ((tmp & (1 << k)) == 0 && f[k][i] < tm && f[k][i] > 0) {
          tp = k;
          tm = f[k][i];
        }
      if (tm >= n) break;
      for (int k = 0; k <= 20; k++)
        if (f[k][i] == tm) tmp += (1 << k);
      if (!mark[tmp]) {
        mark[tmp] = 1;
        res++;
      }
      p = tm + 1;
    }
  }
  cout << res << endl;
  return 0;
}
