#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 100, LOG = 62;
long long n, ans, a[N], ps[N], cnt[N];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> a[i], a[i] = __builtin_popcount(a[i]),
                 ps[i] = (i ? ps[i - 1] : 0) + a[i];
  for (int i = n - 1; i >= 0; i--) cnt[i] = cnt[i + 1] + ((a[i] & 1) == 1);
  for (int i = 0; i < n; i++) {
    long long maxi = 0, sum = 0;
    for (int j = i; j < min(n, i + LOG); j++) {
      maxi = max(maxi, a[i]);
      sum += a[j];
      ans += (2 * maxi <= sum && ((sum & 1) == 0));
    }
    int PS = (i ? ps[i - 1] : 0);
    if (i + LOG < n)
      ans += (PS ? cnt[i + LOG] : (n - (i + LOG) + 1 - cnt[i + LOG]));
  }
  cout << ans;
  return 0;
}
