def bi(x):
    x = bin(x)
    return x[2:len(x)]

def xor(x, y):
    if x > y:
        x, y = y, x
    x = bi(x)
    y = bi(y)
    lenx = len(x)
    leny = len(y)
    if lenx != leny:
        x_new = ""
        for i in range(leny - lenx):
            x_new = "0" + x_new
        x = x_new + x
        
    s = "0b"
    for i in range(len(x)):
        if x[i] != y[i]:
            s += "1"
        else:
            s += "0"

    return int(s, 2)

N = int(input())
L = [x for x in map(int, input().split())]

out = 0
for i in range(N):
    for j in range(N):
        if i > j:
            x = L[i]
            y = L[j]
            out += xor(x, y)
print(out % (10**9 + 7))
