#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
int a[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, cnt = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int j = 1, s = 0;
  for (int i = 1; i <= n; i++) {
    for (; (j <= n) && ((s & a[j]) == 0); j++) s ^= a[j];
    cnt += j - i;
    s ^= a[i];
  }
  cout << cnt;
  return 0;
}
