#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 5;
long long a[N];
int32_t bit_cnt[N];
long long dp[N][2];
int32_t prefix_sum[N];
void solve() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; ++i) {
    cin >> a[i];
    bit_cnt[i] = __builtin_popcountll(a[i]);
  }
  for (long long i = 1; i <= n; ++i) {
    prefix_sum[i] = bit_cnt[i] + prefix_sum[i - 1];
  }
  long long ans = 0;
  dp[0][0] = 1;
  for (long long i = 1; i <= n; ++i) {
    long long c = prefix_sum[i] & 1LL;
    dp[i][0] = dp[i - 1][0];
    dp[i][1] = dp[i - 1][1];
    dp[i][c] += 1;
    ans += dp[i - 1][c];
    long long res = -1, mx = bit_cnt[i];
    long long sum = 0;
    for (long long j = i; i - j <= 62 && j > 0; --j) {
      mx = max(mx, (long long)bit_cnt[j]);
      sum += bit_cnt[j];
      if ((sum - mx < mx) && (sum & 1) == 0) {
        --ans;
      }
    }
  }
  cout << ans << '\n';
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  for (long long i = 1; i <= t; ++i) {
    solve();
  }
  return 0;
}
