# -*- coding: utf-8 -*-

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

ans = []
for i in range(N - 1):  
    for j in range(i + 1, N):
        ans.append(a[i] ^ a[j])
print(sum(ans) % (10 ** 9 + 7))
