#include <bits/stdc++.h>
using i64 = long long;
int main() {
  int n;
  std::cin >> n;
  std::vector<int> a(n), ss{0}, even{1}, odd{0};
  for (int i = 0; i < n; i++) {
    i64 in;
    std::cin >> in;
    const int c = __builtin_popcountll(in);
    a[i] = c;
    ss.push_back(ss.back() + c);
    even.push_back(even.back() + ((ss.back() & 1) ? 0 : 1));
    odd.push_back(odd.back() + ((ss.back() & 1) ? 1 : 0));
  }
  i64 ret = 0;
  for (int i = 0; i + 1 < n; i++) {
    int max = std::max(a[i], a[i + 1]);
    for (int j = 2; j < 120 && i + j <= n; j++) {
      const int s = ss[i + j] - ss[i];
      if ((s & 1) == 0 && s >= 2 * max) ret++;
      if (a[i + j] > max) max = a[i + j];
    }
  }
  for (int i = 0; i + 120 <= n; i++) {
    if (ss[i] & 1) {
      ret += odd.back() - odd[i + 119];
    } else {
      ret += even.back() - even[i + 119];
    }
  }
  std::cout << ret << std::endl;
  return 0;
}
