#include #include int cmp_int (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]; } prev_sort[30] = n+1; qsort(prev_sort, 31, sizeof(int), cmp_int); for (int j = 0; j < 30; j++) { if (prev_sort[j] != prev_sort[j+1] && prev_sort[j] > 0) { dp[i+1] += dp[i]; } } dp[i+1] %= mod_num; } printf("%lld\n", dp[n]); return 0; }