#include <bits/stdc++.h>
using namespace std;
const int MX = 3e5 + 10, MD = 1e9 + 7;
long long n, m, a[MX], ans, tmp, odd[MX], even[MX], ps[MX], res, mx;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> tmp;
    a[i] = __builtin_popcountll(tmp);
    ps[i] = ps[i - 1] + a[i];
    odd[i] = odd[i - 1];
    even[i] = even[i - 1];
    if (ps[i] & 1)
      odd[i]++;
    else
      even[i]++;
  }
  for (int i = 1; i <= n; i++) {
    if (ps[i - 1] & 1)
      ans += (odd[n] - odd[i - 1]);
    else
      ans += (even[n] - even[i - 1]);
  }
  for (int i = 1; i <= n; i++) {
    res = 0;
    mx = 0;
    for (int j = i; j < i + 70; j++) {
      if (j > n) break;
      res += a[j];
      mx = max(mx, a[j]);
      if (!(res & 1) && mx * 2 > res) {
        ans--;
      }
    }
  }
  cout << ans << endl;
}
