#include <bits/stdc++.h>
using namespace std;
const int N = int(3e5) + 5;
const int inf = (int)1e9 + 7;
int n;
int a[N], odd, eve = 1;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    long long x;
    scanf("%lld", &x);
    a[i] = __builtin_popcountll(x);
  }
  long long ans = 0;
  int sum = 0;
  for (int i = 1; i <= n; ++i) {
    sum += a[i];
    if (sum % 2) {
      ans += odd;
      ++odd;
    } else {
      ans += eve;
      ++eve;
    }
  }
  for (int i = 1; i <= n; ++i) {
    sum = 0;
    int mx = 0;
    for (int j = i; j <= n; ++j) {
      sum += a[j];
      mx = max(mx, a[j]);
      if (sum < mx * 2 && sum % 2 == 0) {
        --ans;
      }
      if (sum > 130) {
        break;
      }
    }
  }
  printf("%lld", ans);
  return 0;
}
