#include <bits/stdc++.h>
using namespace std;
int n, a[1000001], d[1000001][25], coun, cnt, pos[1000001][25], q[50];
pair<int, int> minl[50];
map<int, bool> used;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    int cur = a[i];
    coun = 0;
    while (cur != 0) {
      d[i][coun++] = cur % 2;
      cur /= 2;
    }
    if (!used[a[i]]) {
      used[a[i]] = 1;
      cnt++;
    }
  }
  for (int i = 0; i <= 21; i++) {
    if (d[n][i] == 1)
      pos[n][i] = n;
    else
      pos[n][i] = n + 1;
  }
  for (int i = n - 1; i >= 1; i--) {
    for (int j = 0; j <= 21; j++) {
      if (d[i][j] == 1)
        pos[i][j] = i;
      else
        pos[i][j] = pos[i + 1][j];
    }
  }
  for (int l = 1; l <= n; l++) {
    for (int i = 0; i <= 21; i++) q[i] = 0;
    for (int i = 0; i <= 21; i++) {
      minl[i].first = pos[l][i];
      minl[i].second = i;
    }
    sort(minl, minl + 22);
    for (int i = 0; i < 22; i += 0) {
      if (minl[i].first > n) break;
      int r = i;
      while (r <= 21 && minl[r].first == minl[i].first) q[minl[r++].second] = 1;
      int ch = 0, po = 1;
      for (int j = 0; j < 22; j++) {
        ch += q[j] * po;
        po *= 2;
      }
      if (!used[ch]) {
        used[ch] = 1;
        cnt++;
      }
      i = r;
    }
  }
  cout << cnt;
  return 0;
}
