intmain(void) { int n, i, j; scanf("%d", &n); for (i = 1; i <= n; ++i) { scanf("%d", arr + i); for (j = 0; j < 20; ++j) if ((arr[i] >> j) & 1) pos[i][j] = i; } for (i = n - 1; i >= 1; --i) { for (j = 0; j < 20; ++j) { if (!pos[i][j]) pos[i][j] = pos[i + 1][j]; } } int ans = 0; vector<int>bitpos; for (i = 1; i <= n; ++i) { int s = arr[i]; if (++cnt[s] == 1) ++ans; bitpos.clear(); for (j = 0; j < 20; ++j) { if (arr[pos[i + 1][j]]) bitpos.pb(pos[i + 1][j]); } sort(all(bitpos)); for (auto &idx : bitpos) { s |= arr[idx]; if (++cnt[s] == 1) ++ans; } } printf("%d\n", ans); return0; }