#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    ll x;
    cin >> x;
    int c = 0;
    while (x > 0) {
      c += x & 1;
      x >>= 1;
    }
    v[i] = c;
  }
  vector<vector<int>> dp(n, vector<int>(2, 0));
  int s = 0;
  for (int i = 0; i < n; i++) {
    s += v[i];
    dp[i][s & 1] = 1;
    if (i) {
      dp[i][0] += dp[i - 1][0];
      dp[i][1] += dp[i - 1][1];
    } else {
      dp[i][0]++;
    }
  }
  ll ans = 0;
  s = 0;
  for (int i = 0; i < n; i++) {
    s += v[i];
    if (i >= 151) {
      ans += i == 151 ? ((s & 1) == 0) : dp[i - 152][s & 1];
    }
    int cur = v[i];
    int mx = v[i];
    for (int j = i - 1; j >= max(0, i - 150); j--) {
      cur += v[j];
      mx = max(mx, v[j]);
      if (2 * mx <= cur && cur % 2 == 0) ans++;
    }
  }
  cout << ans;
  return 0;
}
