#include <bits/stdc++.h>
int a[300005], sum[300005], odd[300005], even[300005], n;
long long x, ans;
int main() {
  std::scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    std::scanf("%I64d", &x), a[i] = __builtin_popcountll(x);
  for (int i = 1; i <= n; i++)
    sum[i] = sum[i - 1] + a[i], odd[i] = odd[i - 1] + (sum[i] & 1),
    even[i] = i - odd[i];
  for (int i = 1; i <= n; i++) {
    int range = std::min(i + 64, n), sum = a[i], max = a[i];
    for (int j = i; j <= range; sum += a[++j], max = std::max(max, a[j]))
      if (!(sum & 1) && max + max <= sum) ans++;
    if (::sum[i - 1] & 1)
      ans += odd[n] - odd[range];
    else
      ans += even[n] - even[range];
  }
  std::printf("%I64d\n", ans);
  return 0;
}
