def pairORSum(arr, n,mod=10**9+7):
    ans = 0  # Initialize result

    # Consider all pairs (arr[i], arr[j)
    # such that i < j
    for i in range(0, n):

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

    return ans


n=int(input())
A=list(map(int,input().split()))
print(pairORSum(A,n))