#include <bits/stdc++.h>
using namespace std;
int b[300000];
bool chetn[300001];
long long answer;
bool check(int i, int j) {
  int MAX = 0;
  int sum = 0;
  for (int u = i; u <= j; u++) {
    MAX = max(b[u], MAX);
    sum += b[u];
  }
  if (MAX * 2 > sum) return 0;
  return 1;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    while (x > 0) {
      b[i] += x % 2;
      x /= 2;
    }
  }
  int ch, nech;
  ch = nech = 0;
  int summa = 0;
  for (int i = n - 2; i >= 0; i--) {
    summa += b[i + 1];
    chetn[i + 1] = summa % 2;
    if (b[i + 1] % 2 == 0) {
      ch++;
    } else {
      int p = nech;
      nech = ch;
      ch = p;
      nech++;
    }
    if (b[i] % 2 == 0)
      answer += ch;
    else
      answer += nech;
  }
  chetn[0] = (summa + b[0]) % 2;
  chetn[n] = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < min(n, 64 + i); j++) {
      if (chetn[i] == chetn[j + 1]) {
        if (check(i, j) == 0) {
          answer--;
        }
      }
    }
  }
  cout << answer;
  return 0;
}
