#include <bits/stdc++.h>
short int byn(long long x) {
  short int rez = 0;
  while (x > 0) {
    if (x % 2 == 1) rez++;
    x = x / 2;
  }
  return rez;
}
short int a[300000 + 1];
bool s[300000 + 1];
int q[300000 + 1];
int main() {
  int n;
  long long rez = 0;
  std::cin >> n;
  long long x;
  s[0] = 0;
  q[0] = 1;
  for (int i = 1; i <= n; i++) {
    std::cin >> x;
    a[i] = byn(x);
    if (a[i] % 2 == 0) {
      s[i] = s[i - 1];
    } else {
      s[i] = 1 - s[i - 1];
    }
    q[i] = q[i - 1] + 1 - s[i];
  }
  for (int r = 1; r <= n; r++) {
    int max = -1;
    int sum = 0;
    for (int l = r; l >= 1; l--) {
      sum += a[l];
      if (max < a[l]) max = a[l];
      if (sum < 128) {
        if (sum >= 2 * max && sum % 2 == 0) rez++;
      } else {
        if (s[r] % 2 == 0) rez += q[l - 1];
        if (s[r] % 2 == 1) rez += l - q[l - 1];
        l = 0;
      }
    }
  }
  std::cout << rez;
  return 0;
}
