a=int(input())
l=input().split()
count=0
# N=0
for i in range(a):
    for j in range(1,a-i):
        count+=int(l[i])^int(l[a-j])
        # N+=1
        # print(N,"回目")
        # print(l[i],"^",l[a-j],"=",int(l[i])^int(l[a-j]))

print(count)

