n = int(input())
a = list(map(int, input().split()))
 
def xor_(x, y):
    p, q = list(sorted([x, y]))
    p = bin(p)
    q = bin(q)
 
    i = -1
    r = str()
    while p[i] != 'b':
        if p[i] == q[i]:
            r = '0' + r
        else:
            r = '1' + r
        i -= 1
 
    while q[i] != 'b':
        r = q[i] + r
        i -= 1
    
    r = '0b' + r
 
    return(int(r, 0))
 
sum = 0
for i in range(n-1):
    for j in range(i+1, n):
        sum += xor_(a[i], a[j])
        sum = sum % (10**9 + 7)
 
print(sum)