#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
long long n, countBit[N], odd, even, res;
int main() {
  cin >> n;
  long long v;
  cin >> v;
  countBit[1] = __builtin_popcountll(v);
  (countBit[1] % 2) ? odd++ : even++;
  for (int i = 2; i <= n; i++) {
    cin >> v;
    countBit[i] = __builtin_popcountll(v);
    long long bMax = countBit[i], sumBit = countBit[i];
    for (int j = i - 1; j >= max(1, i - 65); --j) {
      sumBit += countBit[j];
      bMax = max(bMax, countBit[j]);
      if (bMax > sumBit - bMax && sumBit % 2 == 0) res--;
    }
    if (countBit[i] % 2) {
      res += odd;
      int temp = even;
      even = odd;
      odd = temp + 1;
    } else {
      res += even;
      even = even + 1;
    }
  }
  cout << res;
  return 0;
}
