#include #include using namespace std; int main() { int n; cin >> n; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } vector ans(n-1, 0); int x = 0; for (int i = 0; i < n-1; i++) { x = x + a[i]; int y = x; for (int j = i+1; j < n; j++) { y = y & a[j]; ans[j-i-1] |= y; } } int cnt = 0; for (int i = 0; i < n-1; i++) { if (ans[i] != 0) { cnt++; } } cout << cnt << endl; return 0; }