n =int(input())
a_list = list(map(int,input().split()))
x = 0
for i in range(1, n):
    ai = a_list[i-1]
    for j in range(i+1, n+1):
        aj = a_list[j-1]
        x += ai ^ aj


print(x % (10**9 + 7))

