#include <bits/stdc++.h>
const int N = 1200000;
int num[N];
int pre[22];
int ss[N] = {0};
int main() {
  int n, m;
  scanf("%d", &n);
  memset(pre, -1, sizeof(pre));
  for (m = 0; n--;) {
    scanf("%d", &num[m]);
    ss[num[m]] = 1;
    if (m == 0 || num[m] != num[m - 1]) ++m;
  }
  for (int i = 0; i < m; ++i) {
    int v = num[i];
    int pos[20], cnt = 0;
    for (int j = 0; j < 20; ++j)
      if (pre[j] != -1) pos[cnt++] = pre[j];
    std::sort(pos, pos + cnt);
    for (int j = cnt - 1; j >= 0; --j) ss[v |= num[pos[j]]] = 1;
    for (int j = 0, s = num[i]; s; ++j, s >>= 1)
      if (s & 1) pre[j] = i;
  }
  int ans = 0;
  for (int i = 0; i < N; ++i) ans += ss[i];
  printf("%d\n", ans);
  return 0;
}
