#include <bits/stdc++.h>
using namespace std;
const long long N = 300000;
long long n, a[N], ct[N];
long long ans;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (long long i = 0; i < n; ++i) cin >> a[i];
  for (long long i = 0; i < n; ++i) {
    long long ai = a[i];
    while (ai) {
      if (ai % 2) ct[i]++;
      ai /= 2;
    }
  }
  long long evens = 0, odds = 0;
  for (long long i = n - 1; i >= 0; --i) {
    cerr << ct[i] << ' ';
    if (ct[i] % 2)
      ans += odds;
    else
      ans += evens;
    if (ct[i] % 2) {
      swap(odds, evens);
      odds++;
    } else {
      evens++;
    }
    long long sm2 = ct[i], mx2 = ct[i];
    for (long long j = i + 1; j < n && sm2 < 128; ++j) {
      sm2 += ct[j];
      mx2 = max(mx2, ct[j]);
      if (sm2 % 2 == 0 && mx2 * 2 > sm2) ans--;
    }
  }
  cerr << endl;
  cout << ans << endl;
  return 0;
}
