#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int lg[N], f[N][20], n, fa[N];
int calc(int x, int y) {
  int ll = lg[y - x + 1];
  return f[x][ll] | f[y - (1 << ll) + 1][ll];
}
int findprev(int x) { return fa[x] > 0 ? fa[x] = findprev(fa[x]) : x; }
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; ++i) lg[i] = lg[i >> 1] + 1;
  for (int i = 1; i <= n; ++i) scanf("%d", &f[i][0]);
  for (int i = 1; i <= lg[n]; ++i)
    for (int j = 1; j <= n; ++j) {
      int t = j + (1 << (i - 1));
      if (t <= n) f[j][i] = f[j][i - 1] | f[t][i - 1];
    }
  for (int i = 1; i <= n; ++i) fa[i] = -i;
  set<int> s;
  for (int i = 1; i <= n; ++i) {
    int la = i;
    while (la) {
      int ret = la;
      for (int l = 1, r = findprev(la - 1), mid = (l + r) >> 1; l <= r;
           mid = (l + r) >> 1)
        if (calc(mid = findprev(mid), i) == calc(la, i))
          ret = mid, r = mid - 1;
        else
          l = -fa[mid] + 1;
      s.insert(calc(la, i));
      if (findprev(la) != ret) fa[ret] = fa[findprev(la)];
      for (int i = findprev(la); i != ret; i = findprev(i - 1)) fa[i] = ret;
      la = findprev(ret - 1);
    }
  }
  cout << s.size();
}
