#include <bits/stdc++.h>
using namespace std;
class TaskB {
 public:
  void solve(istream& in, ostream& out) {
    int n;
    in >> n;
    vector<long long> a(n);
    for (int i = 0; i < n; ++i) {
      in >> a[i];
    }
    vector<long long> cnt1(n + 1, 0), cnt2(n + 1, 0);
    for (int i = n - 1; i >= 0; --i) {
      if (__builtin_popcountll(a[i]) % 2 == 0) {
        cnt1[i] = cnt1[i + 1] + 1;
        cnt2[i] = cnt2[i + 1];
      } else {
        cnt1[i] = cnt2[i + 1];
        cnt2[i] = cnt1[i + 1] + 1;
      }
    }
    long long res = 0;
    for (int i = 0; i < n; ++i) {
      int mx_sum = __builtin_popcountll(a[i]);
      int cur_sum = mx_sum;
      for (int j = i + 1; j <= i + 80 && j < n; ++j) {
        int tmp_sum = __builtin_popcountll(a[j]);
        mx_sum = max(mx_sum, tmp_sum);
        cur_sum += tmp_sum;
        res += (mx_sum <= cur_sum - mx_sum && cur_sum % 2 == 0);
      }
      if (i + 80 < n) {
        if (cur_sum % 2 == 0) {
          res += cnt1[i + 80 + 1];
        } else {
          res += cnt2[i + 80 + 1];
        }
      }
    }
    out << res << "\n";
  }
};
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(nullptr);
  TaskB solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}
