import numpy as np
mod = 10**9+7
n = int(input())
a = [int(x) for x in input().split()]
a = np.array(a)
count = 0


for i in range(0,n):
    f = np.bitwise_xor(a,a[i])
    count+=sum(f)

count = int(count/2)
count = count%(mod)
print(count)