#include <bits/stdc++.h>
using namespace std;
int a[100005];
bool found[2000000];
int lftbit[30];
pair<int, int> bit[30];
int main() {
  int n, i, j, val, cnt = 0, tot;
  memset(lftbit, -1, sizeof(lftbit));
  cin >> n;
  for ((i) = 0; (i) < (n); (i)++) {
    scanf("%d", &a[i]);
    found[a[i]] = true;
    val = a[i];
    tot = 0;
    for (j = 0; j < 22; j++)
      if (lftbit[j] != -1) bit[tot++] = pair<int, int>(lftbit[j], j);
    sort(bit, bit + tot);
    for (j = tot - 1; j >= 0; j--) {
      val |= (1 << bit[j].second);
      while (j - 1 >= 0 && bit[j].first == bit[j - 1].first) {
        j--;
        val |= (1 << bit[j].second);
      }
      found[val] = true;
    }
    for (j = 0; j < 22; j++)
      if (a[i] & (1 << j)) lftbit[j] = i;
  }
  for (i = 0; i < 2000000; i++)
    if (found[i]) cnt++;
  cout << cnt << endl;
  return 0;
}
