import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(2*10**5+10) write = lambda x: sys.stdout.write(x+"\n") debug = lambda x: sys.stderr.write(x+"\n") n = int(input()) a = list(map(int, input().split())) from collections import defaultdict d = defaultdict(int) c = [0] for v in a: c.append(c[-1]^v) d[-1] = 1 s = 1 ans = 1 for v in c[1:-1]: val = s s += (val - d[v]) s %= M d[v] = val print(s%M)