#include <bits/stdc++.h>
using namespace std;
long long n, a[300010], bit[300010], memo[300010][2], pot[70];
void precalc() {
  pot[0] = 1;
  for (long long i = 1; i <= 62; i++) pot[i] = pot[i - 1] * 2;
}
void solve() {
  precalc();
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    for (long long j = 0; j < 62; j++) {
      long long x = pot[j];
      if (x & a[i]) bit[i]++;
    }
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    if (bit[i] % 2 == 0) {
      memo[i][0] = memo[i - 1][0] + 1;
      memo[i][1] = memo[i - 1][1];
    } else {
      memo[i][0] = memo[i - 1][1];
      memo[i][1] = memo[i - 1][0] + 1;
    }
    ans += memo[i][0];
    long long maior = 0, tot = 0;
    for (long long j = i; j >= 1 and j >= i - 62; j--) {
      maior = max(maior, bit[j]);
      tot += bit[j];
      if (tot % 2 == 0 and tot < 2 * maior) ans--;
    }
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
}
