#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
int a[maxn], n;
long long x;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &x);
    a[i] = __builtin_popcountll(x);
  }
  long long res = 0;
  for (int i = 1; i <= n; i++) {
    int maxx = 0, sum = 0;
    for (int j = i; j <= n; j++) {
      maxx = max(maxx, a[j]);
      sum += a[j];
      if (sum > 300) break;
      if (sum < 2 * maxx && sum % 2 == 0) res++;
    }
  }
  long long sum0 = 1, sum1 = 0, flag = 0;
  for (int i = 1; i <= n; i++) {
    flag ^= (a[i] & 1);
    if (flag)
      sum1++;
    else
      sum0++;
  }
  printf("%lld\n", sum0 * (sum0 - 1) / 2 + sum1 * (sum1 - 1) / 2 - res);
  return 0;
}
