// #include using namespace std; #define fi first #define se second #define all(x) x.begin(), x.end() #define lch (o << 1) #define rch (o << 1 | 1) typedef double db; typedef long long ll; typedef unsigned int ui; typedef pair pint; typedef tuple tint; const int N = 2e4; const int M = (1 << 10) + 5; const int INF = 0x3f3f3f3f; const ll INF_LL = 0x3f3f3f3f3f3f3f3f; bool f[N][M][2]; bool cnt[N * M]; int a[N], s[N]; int main() { ios::sync_with_stdio(0); int upp = 1 << 10; int n; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = n; i >= 0; i--) s[i] = s[i + 1] + a[i]; f[0][0][1] = 1; cnt[s[0]] = 1; int ans = 1; for (int i = 0; i < n; i++) { for (int j = 0; j < upp; j++) { for (int k = 0; k <= 1; k++) { if (!f[i][j][k]) continue; // add f[i + 1][(j + a[i + 1]) & (upp - 1)][0] = 1; // and f[i + 1][j & a[i + 1]][1] = 1; } } for (int j = 0; j < upp; j++) { if (f[i + 1][j][1] && cnt[j + s[i + 2]] == 0) { cnt[j + s[i + 2]] = 1; ans++; } } cout << ans << endl; } return 0; }