import itertools


def xORSum(arr, n):
    ans = 0
    for i in range(0, n):
        for j in range(i + 1, n):
            ans = ans + (arr[i] ^ arr[j])
    return ans


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

print(xORSum(a, n) % (10**9+7))
