Buggy python submission (verdict: Time Limit Exceeded):
# D - Xor Sum 2
# https://atcoder.jp/contests/arc098/tasks/arc098_b

import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]

def main_lte(N, An):
    ans = N
    for l in range(N):
        for r in range(l+1, N):
            a = An[l]
            b = An[l]
            for i in range(l+1, r+1):
                a ^= An[i]
                b += An[i]
            if a == b:
                ans += 1
    print(ans)

def main(N, An):
    ans = N
    for l in range(N):
        a = An[l]
        b = An[l]
        for r in range(l+1, N):
            a ^= An[r]
            b += An[r]
            if a == b:
                ans += 1
            else:
                continue
    print(ans)

N = i2n()
An = i2nn()
main(N, An)


Fixed submission:
# D - Xor Sum 2
# https://atcoder.jp/contests/arc098/tasks/arc098_b

import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]

def main_lte(N, An):
    ans = N
    for l in range(N):
        for r in range(l+1, N):
            a = An[l]
            b = An[l]
            for i in range(l+1, r+1):
                a ^= An[i]
                b += An[i]
            if a == b:
                ans += 1
    print(ans)

def main_lte2(N, An):
    ans = N
    for l in range(N):
        a = An[l]
        b = An[l]
        for r in range(l+1, N):
            a ^= An[r]
            b += An[r]
            if a == b:
                ans += 1
            else:
                continue
    print(ans)

def main(N, An):
    ans = 0
    n = 0
    l = 0
    for r in range(N):
        n2 = An[r]
        if n & n2 == 0:
            n += n2
        else:
            while True:
                n -= An[l]
                l += 1
                if n & n2 == 0:
                    n += n2
                    break
        ans += r + 1 - l
    print(ans)

N = i2n()
An = i2nn()
main(N, An)

Buggy python submission (verdict: Time Limit Exceeded):
# D - Xor Sum 2
# https://atcoder.jp/contests/arc098/tasks/arc098_b

import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]

def main(N, An):
    ans = N
    for l in range(N):
        for r in range(l+1, N):
            a = An[l]
            b = An[l]
            for i in range(l+1, r+1):
                a ^= An[i]
                b += An[i]
            if a == b:
                ans += 1
    print(ans)

N = i2n()
An = i2nn()
main(N, An)



Fixed submission:
# D - Xor Sum 2
# https://atcoder.jp/contests/arc098/tasks/arc098_b

import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]

def main_lte(N, An):
    ans = N
    for l in range(N):
        for r in range(l+1, N):
            a = An[l]
            b = An[l]
            for i in range(l+1, r+1):
                a ^= An[i]
                b += An[i]
            if a == b:
                ans += 1
    print(ans)

def main_lte2(N, An):
    ans = N
    for l in range(N):
        a = An[l]
        b = An[l]
        for r in range(l+1, N):
            a ^= An[r]
            b += An[r]
            if a == b:
                ans += 1
            else:
                continue
    print(ans)

def main(N, An):
    ans = 0
    n = 0
    l = 0
    for r in range(N):
        n2 = An[r]
        if n & n2 == 0:
            n += n2
        else:
            while True:
                n -= An[l]
                l += 1
                if n & n2 == 0:
                    n += n2
                    break
        ans += r + 1 - l
    print(ans)

N = i2n()
An = i2nn()
main(N, An)