def two(number):
    c0 = 0
    while number >=2:
        number = number //2
        c0 += 1
    return c0

def binary_system(number):
    digit = two(number)
    n = '1'
    if number == 2:
        n = '10'
    else:
        for i in range(1,digit+1):
            number = number - 2**digit
            if two(number) == digit - i:
                n = n + '1'
            else:
                n = n + '0'
            digit = digit - 1
    print(int(n))

def xor(num10,num20):
    #num1,num2は文字列
    l1 = len(num10)
    l2 = len(num20)
    l = max(l1,l2)
    num1 = list(num10)
    num2 = list(num20)
    if l1 < l2:
        num1.insert(0,'0'*(l2-l1))
    elif l2 < l1:
        num2.insert(0,'0'*(l1-l2))
    for i in range(l):
        if num1[i] == num2[i]:
            num1[i] = '0'
        else:
            num1[i] = '1'
    num1 = "".join(num1)
    print(num1)

n = input()
l = input().split()
for i in range(n):
    l[i] = two(l[i])
c = 0
for i in range(n):
    for j in range(n):
        c = c + xor(l[i],l[j])

a = c % ((10**9)+ 7 )
print (a)


