from collections import defaultdict

n = int(input())
a = list(map(int, input().split()))
MOD = 10**9+7
ans = 0
cnt = defaultdict(int)

for i in range(n):
    for j in range(i+1, n):
        if a[i] == a[j]: continue
        par = (min(a[i], a[j]), max(a[i], a[j]))
        cnt[par] += 1

for par, c in cnt.items():
    ans += c*(par[0]^par[1])
    ans %= MOD

print(ans)