#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll n;
  cin >> n;
  vector<ll> v(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
    v[i] = __builtin_popcountll(v[i]);
  }
  ll ans = 0, sum = 0;
  vector<vector<ll>> dp(n + 1, vector<ll>(2));
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    ll tmp = 0, sub = 0;
    for (int j = i; j > 0 && j >= i - 61; j--) {
      tmp += v[j];
      if (v[i] > tmp - v[i] && (tmp & 1LL) == 0) sub++;
    }
    sum += v[i];
    dp[i][0] = dp[i - 1][0];
    dp[i][1] = dp[i - 1][1];
    dp[i][sum & 1LL]++;
    ans += dp[i - 1][sum & 1LL];
    ans -= sub;
  }
  cout << ans;
}
