#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<long long> a(n, 0);
  vector<long long> pref(n + 1, 0);
  vector<long long> dp(2, 0);
  long long ans = 0;
  for (int i = 0; (i) < n; ++(i)) {
    long long ai;
    cin >> ai;
    bitset<64> bits(ai);
    a[i] = bits.count();
    pref[i + 1] = (pref[i] + a[i]) & 1;
  }
  for (int i = 1; i <= n; ++i) {
    ans += dp[pref[i]];
    dp[pref[i - 1]]++;
  }
  for (int r = 0; (r) < n; ++(r)) {
    long long maxx = a[r];
    long long su = a[r];
    for (int l = r - 1; l >= max(0, r - 65); --l) {
      maxx = max(maxx, a[l]);
      su += a[l];
      if (!(su & 1) && maxx * 2 > su) ans--;
      if (su > 128) break;
    }
  }
  cout << ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int tests = 1;
  for (int _ = 0; (_) < tests; ++(_)) {
    solve();
  }
  return 0;
}
