#include <bits/stdc++.h>
using namespace std;
ofstream file("debug.txt");
template <typename Int>
ostream &operator<<(ostream &s, const vector<Int> &v) {
  s << '[';
  for (auto i = v.begin(); i != v.end(); i++) {
    s << *i;
    if (i != prev(v.end())) s << ", ";
  }
  s << ']';
  return s;
}
template <typename Int, typename INT>
ostream &operator<<(ostream &s, const map<Int, INT> &mp) {
  s << '[';
  for (auto &i : mp) {
    s << '[' << i.first << ", " << i.second << ']';
    if (i != *mp.rbegin()) s << ", ";
  }
  s << ']';
  return s;
}
template <typename Int>
ostream &operator<<(ostream &s, const set<Int> &st) {
  s << '[';
  for (auto &i : st) {
    s << i;
    if (i != *st.rbegin()) s << ", ";
  }
  s << ']';
  s << '\n';
  return s;
}
template <typename Int, typename INt>
ostream &operator<<(ostream &s, const pair<Int, INt> &x) {
  s << '[' << x.first << ", " << x.second << ']';
  return s;
}
template <typename T>
void print(T *x, int n) {
  for (int i = 0; i < n; i++) {
    file << x[i] << " \n"[i == n - 1];
  }
}
template <typename T>
ostream &operator<<(ostream &s, const complex<T> &a) {
  s << '(' << a.real() << ", " << a.imag() << ')';
  return s;
}
const int N = 1e5 + 5;
int n, a[N], ans, bit[20][N];
vector<int> p[20];
bool used[1 << 20];
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < 20; i++) {
    p[i].push_back(0);
    if (a[0] & (1 << i)) bit[i][0]++;
    for (int j = 1; j < n; j++) {
      if ((a[j] & (1 << i)) != (a[p[i].back()] & (1 << i))) p[i].push_back(j);
      if (a[j] & (1 << i)) bit[i][j]++;
      bit[i][j] += bit[i][j - 1];
    }
  }
  for (int i = 0; i < n; i++) {
    set<int> st;
    st.insert(i);
    for (int j = 0; j < 20; j++) {
      int l = 0, r = p[j].size() - 1, md, idx = -1;
      while (l <= r) {
        md = l + r >> 1;
        if (p[j][md] > i) {
          idx = md;
          r = md - 1;
        } else
          l = md + 1;
      }
      if (~idx) st.insert(p[j][idx]);
    }
    for (const int &x : st) {
      int num = 0;
      for (int j = 0; j < 20; j++)
        if (bit[j][x] - (i ? bit[j][i - 1] : 0)) num |= 1 << j;
      if (!used[num]) {
        used[num] = 1;
        ans++;
      }
    }
  }
  cout << ans;
}
