def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7

n = INT()
a = MAP()

ans=0
for i in range(n-1):
    for j in range(i+1,n):
        ans+= a[i]^a[j]
print(ans%MOD)