#include <bits/stdc++.h>
using namespace std;
constexpr long long maxn = 3e5 + 4;
long long C[maxn], pre[maxn][2];
signed main() {
  long long N;
  cin >> N;
  for (long long i = 1; i <= N; ++i) {
    long long a;
    cin >> a;
    C[i] = __builtin_popcount(a);
  }
  for (long long i = 1; i <= N; ++i) {
    pre[i][0] = pre[i - 1][0];
    pre[i][1] = pre[i - 1][1];
    ++pre[i][C[i] & 1];
  }
  long long ans = 0, psum = 0;
  for (long long i = 1; i <= N; ++i) {
    long long sum = 0;
    for (long long j = i; j <= N && j <= i + 64; ++j) {
      sum += C[j];
      if ((sum & 1) == 0 && C[j] * 2 <= sum) ++ans;
    }
    ans += pre[N][psum] - pre[min(N, i + 64)][psum];
    psum ^= C[i] & 1;
  }
  cout << ans << endl;
  return 0;
}
