# coding: utf-8
import math
#n, k, s = map(int,input().split())
n = int(input())
A = list(map(int,input().split()))
ans = 0
MOD=10**9+7
for i in range(n-1):
    for j in range(i+1, n):
        ans += A[i] ^ A[j]
        ans %= MOD
print(ans)