n = int(input())
a = list(map(int, input().split()))

from itertools import combinations

MOD = 10**9+7
ans = 0

for c in combinations(a, 2):
    tmp = c[0]^c[1]
    tmp %= MOD
    ans += c[0]^c[1]
    ans %= MOD

print(ans%MOD)