Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

count = N
Sum = 0

for l in range(0, N-1):
    Sum = A[l]
    r = l+1
    while r < N and Sum + A[r] == Sum ^ A[r]:
            Sum += A[r]
            r += 1
    count += r-l-1
    
print(count)

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

count = 0
Sum = 0
r = 0

for l in range(0, N):
    #Sum = A[l]
    while r < N and Sum + A[r] == Sum ^ A[r]:
            Sum += A[r]
            r += 1
    count += r-l
    if(l==r):
        r+=1
    else:
        Sum -= A[l]
    
    
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

count = N
Sum = 0

for l in range(0, N-1):
    Sum = A[l]
    r = l+1
    while r < N and Sum + A[r] == Sum ^ A[r]:
            Sum += A[r]
            count += 1
            r += 1
            
print(count)

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

count = 0
Sum = 0
r = 0

for l in range(0, N):
    #Sum = A[l]
    while r < N and Sum + A[r] == Sum ^ A[r]:
            Sum += A[r]
            r += 1
    count += r-l
    if(l==r):
        r+=1
    else:
        Sum -= A[l]
    
    
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

count = N
Sum = 0

for l in range(0, N-1):
    Sum = A[l]
    for r in range(l+1, N):
        if Sum + A[r] != Sum ^ A[r]:
            #print(l,r)
            count -= 1
            break
        else:
            Sum += A[r]
            #count += 1
    count += r-l
print(count)

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

count = 0
Sum = 0
r = 0

for l in range(0, N):
    #Sum = A[l]
    while r < N and Sum + A[r] == Sum ^ A[r]:
            Sum += A[r]
            r += 1
    count += r-l
    if(l==r):
        r+=1
    else:
        Sum -= A[l]
    
    
print(count)

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

count = N
Sum = 0

for l in range(0, N-2):
    Sum = A[l]
    for r in range(l+1, N-1):
        if Sum + A[r] != Sum ^ A[r]:
            break
        else:
            Sum += A[r]
            #count += 1
    count += r-l-1
print(count)

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

count = 0
Sum = 0
r = 0

for l in range(0, N):
    #Sum = A[l]
    while r < N and Sum + A[r] == Sum ^ A[r]:
            Sum += A[r]
            r += 1
    count += r-l
    if(l==r):
        r+=1
    else:
        Sum -= A[l]
    
    
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!

N = int(input())
A = list(map(int,input().split()))

count = N
Sum = 0

for l in range(0, N-1):
    Sum = A[l]
    for r in range(l+1, N):
        #print(l,r)
        if Sum + A[r] != Sum ^ A[r]:
            break
        else:
            Sum += A[r]
            count += 1
    #count += r-l
    #if r== l:
    #    r += 1
    #else:
    #    Sum -= A[l]
print(count)

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

count = 0
Sum = 0
r = 0

for l in range(0, N):
    #Sum = A[l]
    while r < N and Sum + A[r] == Sum ^ A[r]:
            Sum += A[r]
            r += 1
    count += r-l
    if(l==r):
        r+=1
    else:
        Sum -= A[l]
    
    
print(count)

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

l_max = len(A)
#print(l_max)
r = 0
count = l_max
Sums = 0
for l in range(0, l_max):
    for r in range(l+1, l_max):
       if Sums + A[r] == Sums ^ A[r]
            Sums += A[r]
            count += 1

print(count)

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

count = 0
Sum = 0
r = 0

for l in range(0, N):
    #Sum = A[l]
    while r < N and Sum + A[r] == Sum ^ A[r]:
            Sum += A[r]
            r += 1
    count += r-l
    if(l==r):
        r+=1
    else:
        Sum -= A[l]
    
    
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!

N = int(input())
A = list(map(int,input().split()))

l_max = len(A)
#print(l_max)
r = 0
count = l_max
bit_max = 0
    
    
for l in range(0, l_max):
    bitSums = A[l]
    Sums = A[l]
    bit_max = max(A[l:l_max])
    for r in range(l+1, l_max):
        Sums = Sums + A[r]
        if len(bin(Sums))>len(bin(bit_max)):
            #print('break!')
            break
        bitSums = bitSums ^ A[r]
        if bitSums == Sums:
            count += 1

print(count)

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

count = 0
Sum = 0
r = 0

for l in range(0, N):
    #Sum = A[l]
    while r < N and Sum + A[r] == Sum ^ A[r]:
            Sum += A[r]
            r += 1
    count += r-l
    if(l==r):
        r+=1
    else:
        Sum -= A[l]
    
    
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

l_max = len(A)
#print(l_max)
r = 0
count = l_max

for l in range(0, l_max):
    bitSums = A[l]
    Sums = A[l]
    for r in range(l+1, l_max):
        bitSums = bitSums ^ A[r]
        Sums = Sums + A[r]
        #print(Sums)
        if bitSums == Sums:
            count += 1

print(count)

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

count = 0
Sum = 0
r = 0

for l in range(0, N):
    #Sum = A[l]
    while r < N and Sum + A[r] == Sum ^ A[r]:
            Sum += A[r]
            r += 1
    count += r-l
    if(l==r):
        r+=1
    else:
        Sum -= A[l]
    
    
print(count)