#include #include int cmp_int_rev (const void *ap, const void *bp) { int a = *(int *)ap; int b = *(int *)bp; if (a < b) { return 1; } if (a > b) { return -1; } return 0; } int main () { int n = 0; int a = 0; int res = 0; long long dp[200001] = {}; long long mod_num = 998244353LL; int prev[30] = {}; res = scanf("%d", &n); dp[0] = 1LL; for (int i = 0; i < n; i++) { int prev_sort[31] = {}; res = scanf("%d", &a); for (int j = 0; j < 30; j++) { if ((a&(1< 0) { prev[j] = i+1; } prev_sort[j] = prev[j]; } qsort(prev_sort, 31, sizeof(int), cmp_int_rev); dp[i+1] = dp[i]; for (int j = 0; j < 30; j++) { if (prev_sort[j] > 0 && prev_sort[j] <= i && prev_sort[j] != prev_sort[j+1]) { dp[i+1] += dp[prev_sort[j]]; dp[i+1] %= mod_num; } } } printf("%lld\n", dp[n]); return 0; }