#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
long long a[maxn];
int b[maxn];
int c[maxn][2];
int sum[maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &a[i]), b[i] = __builtin_popcountll(a[i]),
                           sum[i] = sum[i - 1] + b[i];
    if (b[i] & 1)
      c[i][1] = c[i - 1][1] + 1, c[i][0] = c[i - 1][0];
    else
      c[i][1] = c[i - 1][1], c[i][0] = c[i - 1][0] + 1;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int mx = 0;
    for (int j = i; j <= i + 63; j++) {
      mx = max(mx, b[i]);
      if ((sum[j] - sum[i - 1]) % 2 == 0 && 2 * mx <= (sum[j] - sum[i - 1])) {
        ans++;
      }
    }
    if (i + 63 < n) {
      if (sum[i - 1] & 1)
        ans += c[n][1] - c[i + 63][1];
      else
        ans += c[n][0] - c[i + 63][0];
    }
  }
  printf("%d\n", ans);
  return 0;
}
