#include <bits/stdc++.h>
using namespace std;
int dp[100100][24];
int a[3000100];
int n, mas[100100], st[100100][24], inf = 10000000, ans;
int was[25];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &mas[i]);
    int xx = mas[i];
    for (int j = 1; j <= 20; j++) {
      st[i][j] = xx % 2;
      xx /= 2;
    }
  }
  for (int i = 1; i <= 20; i++) {
    dp[n + 1][i] = inf;
  }
  for (int i = n; i >= 1; i--) {
    for (int j = 1; j <= 20; j++) {
      if (st[i][j] == 1)
        dp[i][j] = i;
      else
        dp[i][j] = dp[i + 1][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    int tek = mas[i];
    for (int j = 1; j <= 20; j++) was[j] = st[i][j];
    int pos = i;
    while (pos < inf) {
      tek = tek | mas[pos];
      a[tek] = 1;
      for (int j = 1; j <= 20; j++) {
        if (was[j] == 1 || st[pos][j] == 1)
          was[j] = 1;
        else
          was[j] = 0;
      }
      int to = inf;
      for (int j = 1; j <= 20; j++) {
        if (was[j] == 1) continue;
        to = min(to, dp[pos][j]);
      }
      pos = to;
    }
  }
  for (int i = 0; i < 3000000; i++) ans += a[i];
  cout << ans << endl;
  return 0;
}
