P = 998244353 N = int(input()) A = list(map(int, input().split())) ppos = [] pd = [1] for i, v in enumerate(A): pos = [i] for j in reversed(ppos): nv = v | A[j] if nv != v: v = nv pos.append(j) pos.reverse() siz = len(pos) dp = [0] * (siz + 1) j = 0 for k in range(siz): while j < len(ppos) and ppos[j] <= pos[k]: j += 1 dp[k + 1] = dp[k] + pd[j] pd = [v % P for v in dp] ppos = pos print(pd[-1])