# https://atcoder.jp/contests/abc147/tasks/abc147_d
n = int(input())
nums = [int(i) for i in input().split()]

mod = 10 ** 9 + 7

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        ans += (nums[i] ^ nums[j]) % mod

print(ans % mod)