# coding:utf-8

N = int(input())
values = [int(num) for num in input().split(' ')]

ans = 0
for i in range(len(values)):
    for j in range(i, len(values)):
        ans += values[i] ^ values[j]

print(ans%(10**9+7))