#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  long long n;
  cin >> n;
  long long arr[n], tab[n];
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    arr[i] = __builtin_popcountll(a);
  }
  cout << endl;
  long long co0 = 0, co1 = 0, bo = 0;
  long long ans = 0;
  if (arr[0] % 2 == 0)
    co0++;
  else
    co1++;
  for (long long i = 1; i < n; i++) {
    if (arr[i] % 2 == 0) {
      ans += co0;
      co0++;
    } else {
      ans += co1;
      swap(co0, co1);
      co1++;
    }
    long long sum = arr[i], ma = arr[i];
    for (long long j = i - 1; j >= max(0ll, i - 64); j--) {
      sum += arr[j];
      ma = max(arr[j], ma);
      if (sum % 2 == 0 && sum - ma < ma) {
        ans--;
      }
    }
  }
  cout << ans << endl;
}
