#include <bits/stdc++.h>
using namespace std;
long long int MOD = 1000000007;
long long int inf = 1e15;
void scan(int &x);
long long int powermod(long long int _a, long long int _b, long long int _m) {
  long long int _r = 1;
  while (_b) {
    if (_b % 2 == 1) _r = (_r * _a) % _m;
    _b /= 2;
    _a = (_a * _a) % _m;
  }
  return _r;
}
long long int string_to_number(string s) {
  long long int x = 0;
  stringstream convert(s);
  convert >> x;
  return x;
}
long long int add(long long int a, long long int b) {
  long long int x = (a + b) % MOD;
  return x;
}
long long int mul(long long int a, long long int b) {
  long long int x = (a * b) % MOD;
  return x;
}
long long int sub(long long int a, long long int b) {
  long long int x = (a - b + MOD) % MOD;
  return x;
}
long long int divi(long long int a, long long int b) {
  long long int x = a;
  long long int y = powermod(b, MOD - 2, MOD);
  long long int res = (x * y) % MOD;
  return res;
}
set<int> cnt;
int dp[100003][20], n;
int getNextBit(int i, int j) {
  int l = i + 1, r = n, idx = -1;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (dp[mid][j] - dp[i - 1][j] >= 1) {
      r = mid - 1;
      idx = mid;
    } else
      l = mid + 1;
  }
  return idx;
}
int main(void) {
  cin >> n;
  int arr[n];
  for (int i = 1; i <= n; i++) scan(arr[i]);
  for (int i = 1; i <= n; i++) {
    int num = arr[i];
    for (int j = 0; j < 20; j++) dp[i][j] = (num >> j) & 1;
  }
  for (int i = 2; i <= n; i++)
    for (int j = 0; j < 20; j++) dp[i][j] += dp[i - 1][j];
  for (int i = 1; i <= n; i++) {
    int currNum = arr[i];
    cnt.insert(currNum);
    map<int, vector<int> > mp;
    for (int j = 0; j < 20; j++) {
      if (((arr[i] >> j) & 1) == 0) {
        int nxt = getNextBit(i, j);
        if (nxt != -1) mp[nxt].push_back(j);
      }
    }
    for (auto it : mp) {
      for (auto jt : it.second) currNum += (1 << jt);
      cnt.insert(currNum);
    }
  }
  cout << cnt.size();
  return 0;
}
void scan(int &x) {
  register int c = getchar();
  x = 0;
  int neg = 0;
  for (; ((c < 48 || c > 57) && c != '-'); c = getchar())
    ;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (neg) x = -x;
}
