#!python3

def resolve():
    N = int(input())
    A = tuple(map(int, input().rstrip().split()))

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

if __name__ == "__main__":
    resolve()
