#include <bits/stdc++.h>
using namespace std;
int64_t n, e, o, ans, a[300001], sm[300001], cnt[300001];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int64_t i = 1; i <= n; ++i) {
    cin >> a[i];
    sm[i] = (sm[i - 1] ^ a[i]);
    if (__builtin_popcountll(sm[i]) % 2 == 0)
      ++e;
    else
      ++o;
  }
  for (int64_t i = 1; i <= n; ++i) {
    cnt[i] = __builtin_popcountll(a[i]);
    ans += e;
    if (cnt[i] & 1) swap(e, o);
    --e;
  }
  for (int64_t i = 1; i <= n; ++i) {
    int64_t sm = 0, mx = 0, temp;
    for (int64_t j = i; j <= n; ++j) {
      mx = max(mx, cnt[j]);
      sm += cnt[j];
      if (sm % 2 == 0 && 2 * mx > sm) --ans;
      if (sm > 125) break;
    }
  }
  cout << ans;
}
