#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int oo = 0x3f3f3f3f;
int mycount(long long u) {
  int ans = 0;
  while (u) {
    ans += u & 1;
    u >>= 1;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> T(n + 1), P(n + 1);
  vector<int> C(2);
  for (int i = 1; i <= n; ++i) {
    long long u;
    cin >> u;
    T[i] = mycount(u);
    P[i] = T[i] + P[i - 1];
    C[P[i] & 1]++;
  }
  long long answer = 0;
  for (int i = 1; i <= n; ++i) {
    vector<int> D = C;
    int sum = 0, mx = 0;
    for (int j = i; j <= min(i + 65, n); ++j) {
      D[P[j] & 1]--;
      sum += T[j];
      mx = max(mx, T[j]);
      if (sum % 2 == 0 && 2 * mx <= sum) {
        answer++;
      }
    }
    answer += D[P[i - 1] & 1];
    C[P[i] & 1]--;
  }
  cout << answer << '\n';
  return 0;
}
