Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

ans = N
j = 1
s = A[0] + A[1] if N > 0 else A[0]
x = A[0] ^ A[1] if N > 0 else A[0]
for i, a in enumerate(A):
    if j == i:
        j += 1
        if j == N:
            break
        x = x ^ A[j]
        s += A[j]

    while True:
        if j == N:
            break
        if s == x:
            ans += j-i
            j += 1
            if j == N:
                break
            s += A[j]
            x = x ^ A[j]
        else:
            s -= a
            x = x ^ a
            break
    if j == N:
        break

print(ans)


Fixed submission:
import sys
N = int(input())
A = list(map(int, input().split()))

ans = N
if N == 1:
    print(1)
    sys.exit()
j = 1
s = A[0] + A[1]
x = A[0] ^ A[1]
for i, a in enumerate(A):
    if j == i:
        j += 1
        if j == N:
            break
        x = x ^ A[j]
        s += A[j]

    while True:
        if j == N:
            break
        if s == x:
            ans += j-i
            j += 1
            if j == N:
                break
            s += A[j]
            x = x ^ A[j]
        else:
            s -= a
            x = x ^ a
            break
    if j == N:
        break

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

ans = N
j = 1
s = A[0] + A[1] if N > 0 else A[0]
x = A[0] | A[1] if N > 0 else A[0]
for i, a in enumerate(A):
    x = a
    s = a
    if j == i:
        j += 1
    if j == N:
        break
    for k in range(j-i):
        x = x | A[1 + i + k]
        s += A[1 + i + k]
    while True:
        if j == N:
            break
        if s == x:
            ans += j-i
            j += 1
            if j == N:
                break
            s += A[j]
            x = x | A[j]
        else:
            break

print(ans)


Fixed submission:
import sys
N = int(input())
A = list(map(int, input().split()))

ans = N
if N == 1:
    print(1)
    sys.exit()
j = 1
s = A[0] + A[1]
x = A[0] ^ A[1]
for i, a in enumerate(A):
    if j == i:
        j += 1
        if j == N:
            break
        x = x ^ A[j]
        s += A[j]

    while True:
        if j == N:
            break
        if s == x:
            ans += j-i
            j += 1
            if j == N:
                break
            s += A[j]
            x = x ^ A[j]
        else:
            s -= a
            x = x ^ a
            break
    if j == N:
        break

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

ans = N
j = 1
s = A[0] + A[1] if N > 0 else A[0]
x = A[0] | A[1] if N > 0 else A[0]
for i, a in enumerate(A):
    x = a
    s = a
    if j == i:
        j += 1
    if j == N:
        break
    for k in range(j-i):
        x = x | A[1 + i + k]
        s += A[1 + i + k]
    while True:
        print(i,j,ans, x, s)
        if j == N:
            break
        if s == x:
            ans += j-i
            j += 1
            if j == N:
                break
            s += A[j]
            x = x | A[j]
        else:
            break

print(ans)


Fixed submission:
import sys
N = int(input())
A = list(map(int, input().split()))

ans = N
if N == 1:
    print(1)
    sys.exit()
j = 1
s = A[0] + A[1]
x = A[0] ^ A[1]
for i, a in enumerate(A):
    if j == i:
        j += 1
        if j == N:
            break
        x = x ^ A[j]
        s += A[j]

    while True:
        if j == N:
            break
        if s == x:
            ans += j-i
            j += 1
            if j == N:
                break
            s += A[j]
            x = x ^ A[j]
        else:
            s -= a
            x = x ^ a
            break
    if j == N:
        break

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

ans = N
j = 1
s = A[0] + A[1] if N > 0 else A[0]
x = A[0]
for i, a in enumerate(A):
    x = a
    s = a
    if j == i:
        j += 1
    if j == N:
        break
    for k in range(j-i):
        x = x | A[1 + i + k]
        s += A[1 + i + k]
    while True:
        print(i,j,ans, x, s)
        if j == N:
            break
        if s == x:
            ans += j-i
            j += 1
            if j == N:
                break
            s += A[j]
            x = x | A[j]
        else:
            break

print(ans)




Fixed submission:
import sys
N = int(input())
A = list(map(int, input().split()))

ans = N
if N == 1:
    print(1)
    sys.exit()
j = 1
s = A[0] + A[1]
x = A[0] ^ A[1]
for i, a in enumerate(A):
    if j == i:
        j += 1
        if j == N:
            break
        x = x ^ A[j]
        s += A[j]

    while True:
        if j == N:
            break
        if s == x:
            ans += j-i
            j += 1
            if j == N:
                break
            s += A[j]
            x = x ^ A[j]
        else:
            s -= a
            x = x ^ a
            break
    if j == N:
        break

print(ans)