#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));
  dp[0][0] = 1;
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    int s = 0;
    int j = i - 1;
    while (j >= 0 && v[i] > s) {
      s += v[j];
      j--;
    }
    if (v[i] <= s) {
      int cur = v[i] + (i ? v[i - 1] : 0);
      ans += j == -1 ? 1 : dp[j][cur & 1];
    }
    if (i) {
      dp[i][0] += dp[i - 1][0];
      dp[i][1] += dp[i - 1][1];
      v[i] += v[i - 1];
    }
    dp[i][v[i] & 1]++;
  }
  cout << ans;
  return 0;
}
