#include <bits/stdc++.h>
using namespace std;
const double PI = 2 * acos(0);
int amt[300005];
int pref[300005];
int main() {
  int n;
  scanf("%d", &n);
  int es = 1;
  int os = 0;
  long long ret = 0;
  for (int i = 0; i < n; i++) {
    long long curr;
    scanf("%lld", &curr);
    amt[i] = __builtin_popcountll(curr);
    pref[i + 1] = pref[i] + amt[i];
    int seen = 0;
    int maxS = 0;
    for (int j = i; j >= 0; j--) {
      seen += amt[j];
      maxS = max(maxS, amt[j]);
      if (seen % 2 == 0 && maxS * 2 > seen) ret--;
      if (seen > 130) break;
    }
    if (pref[i + 1] % 2)
      ret += os++;
    else
      ret += es++;
  }
  printf("%lld\n", ret);
}
