import numpy as np

MAX = 10**9+7

n = int(input())
l = input()
l = list(map(int, l.split()))
l = np.array(l, type=int)


#sum_xor = (l.reshape((-1,1))^l).sum() / 2
#sum_xor = int(sum_xor)

ary = l.reshape((-1,1))^l % MAX
ary = ary.sum(axis=0) % MAX
sum_xor = ary.sum() % MAX
sum_xor = int(sum_xor)

print(sum_xor)
