#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, hi = 0;
    for (int j = i; j > 0 && j >= i - 64; j--) {
      tmp += v[j];
      hi = max(hi, v[j]);
      if (hi > tmp - hi && (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;
}
