#include <bits/stdc++.h>
using namespace std;
const int N = 300010, LOG = 64;
int n, arr[N], nxt[N][LOG], mx, sum[N];
long long p, ans = 0;
vector<int> seg[2][4 * N];
bool b;
void build(int s, int e, int idx) {
  if (s == e) {
    if (sum[s] % 2 == b) seg[b][idx].push_back(sum[s]);
    return;
  }
  build(s, (s + e) / 2, idx * 2);
  build((s + e) / 2 + 1, e, idx * 2 + 1);
  for (int i = 0; i < (int)seg[b][idx * 2].size(); i++)
    seg[b][idx].push_back(seg[b][idx * 2][i]);
  for (int i = 0; i < (int)seg[b][idx * 2 + 1].size(); i++)
    seg[b][idx].push_back(seg[b][idx * 2 + 1][i]);
  sort(seg[b][idx].begin(), seg[b][idx].end());
}
int l, r, val;
int get(int s, int e, int idx) {
  if (s > r || e < l) return 0;
  if (s >= l && e <= r)
    return seg[b][idx].end() -
           lower_bound(seg[b][idx].begin(), seg[b][idx].end(), val);
  return get(s, (s + e) / 2, idx * 2) + get((s + e) / 2 + 1, e, idx * 2 + 1);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < LOG; i++) nxt[n][i] = n;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &p);
    arr[i] = 0;
    for (int j = 62; j >= 0; j--) {
      if (((p >> j) & 1) == 1) {
        arr[i]++;
      }
    }
    sum[i] = arr[i];
    if (i) sum[i] += sum[i - 1];
  }
  b = 0;
  build(0, n - 1, 1);
  b = 1;
  build(0, n - 1, 1);
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < LOG; j++) {
      if (arr[i] == j)
        nxt[i][j] = i;
      else
        nxt[i][j] = nxt[i + 1][j];
    }
    mx = n;
    b = (i == 0 ? 0 : sum[i - 1] % 2);
    for (int j = LOG - 1; j >= 0; j--) {
      if (nxt[i][j] >= mx) continue;
      l = nxt[i][j];
      r = mx - 1;
      val = 2 * j + (i == 0 ? 0 : sum[i - 1]);
      ans += get(0, n - 1, 1);
      mx = nxt[i][j];
    }
  }
  cout << ans << endl;
  return 0;
}
