#include <bits/stdc++.h>
using namespace std;
int cnt[300300];
int p[300300];
int main() {
  int n;
  scanf("%d", &n);
  long long a;
  for (int i = 1; i <= n; i++) {
    scanf(" %I64d", &a);
    while (a) {
      if (a & 1) {
        cnt[i]++;
      }
      a >>= 1;
    }
    p[i] = p[i - 1] + cnt[i];
  }
  long long res = 0;
  for (int i = 1; i < n; i++) {
    if (cnt[i] == cnt[i + 1]) {
      res++;
    }
  }
  for (int i = 1; i < n; i++) {
    int mx = max(cnt[i], cnt[i + 1]);
    int s = cnt[i] + cnt[i + 1];
    for (int j = 2; j <= 63; j++) {
      if (i + j > n) break;
      mx = max(mx, cnt[i + j]);
      s += cnt[i + j];
      if (s % 2 == 0 && mx <= s - mx) {
        res++;
      }
    }
  }
  int cnt0 = 0, cnt1 = 0;
  for (int i = 65; i <= n; i++) {
    if (p[i - 65] % 2 == 0) {
      cnt0++;
    } else {
      cnt1++;
    }
    res += (p[i] % 2 == 0) ? cnt0 : cnt1;
  }
  cout << res;
  return 0;
}
