#include <bits/stdc++.h>
using namespace std;
int amount;
int numbers[300005];
int parity[300005][2], sums[300005];
void solve() {
  long long total = 0;
  for (int i = 1; i <= amount; i++) {
    sums[i] = sums[i - 1] + numbers[i];
    int max_num = 0;
    int run = min(i, 120);
    for (int j = 1; j <= run; j++) {
      max_num = max(max_num, numbers[i - j + 1]);
      if ((sums[i] - sums[j - 1]) % 2 == 0)
        total += (2 * max_num <= sums[i] - sums[j - 1]);
    }
    parity[i][0] = parity[i - 1][0], parity[i][1] = parity[i - 1][1];
    parity[i][sums[i] & 1]++;
    if (i != run) total += parity[i - run - 1][sums[i] & 1];
  }
  printf("%lld", total);
}
int main() {
  scanf("%d", &amount);
  for (int i = 1; i <= amount; i++) {
    long long num;
    scanf("%lld", &num);
    while (num) numbers[i] += num & 1, num >>= 1;
  }
  solve();
}
