#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b, long long m = 1000000007) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long res = power(a, b / 2, m);
  res = (res * res) % m;
  if (b & 1) res = (res * a) % m;
  return res;
}
long long modinv(long long a, long long m = 1000000007) {
  return power(a, m - 2, m);
}
long long add(long long a, long long b, long long m = 1000000007) {
  long long c = (a % m + b % m);
  if (c >= m) c -= m;
  return c;
}
long long sub(long long a, long long b, long long m = 1000000007) {
  long long c = (a % m - b % m);
  if (c < 0) c += m;
  return c;
}
long long mul(long long a, long long b, long long m = 1000000007) {
  return (a * b) % m;
}
void solve() {
  long long n, i, j, ans = 0, sum = 0;
  cin >> n;
  long long a[n], maxi, p[n + 1], suf[n + 1][2];
  p[0] = 0;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] = __builtin_popcountll(a[i]);
    p[i] = p[i - 1] + a[i];
  }
  memset(suf, 0, sizeof(suf));
  for (i = n; i > 0; i--) {
    suf[i][p[i] % 2] = 1;
    if (i == n) continue;
    suf[i][0] += suf[i + 1][0];
    suf[i][1] += suf[i + 1][1];
  }
  for (i = n - 1; i > 0; i--) {
    sum = a[i];
    maxi = a[i];
    for (j = 1; j < 61 && i + j <= n; j++) {
      maxi = max(maxi, a[i + j]);
      sum += a[i + j];
      if (2 * maxi > sum) {
        ans -= (sum % 2 == 0);
      }
    }
    ans += suf[i + 1][p[i - 1] % 2];
  }
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  for (long long i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
