
def trans(number):
    i = 0
    while(1):
        i += 1
        if(number - 2**i < 0):
            i = i - 1
            break


    sel = [0 for i in range(61)]
    sel[- (i + 1)] = 1
    number = number - 2**i
    i = i - 1
    count = -(i + 1)
    while(i >= 0):
        if(number - 2**i >= 0):
            number = number - 2**i
            sel[count] = 1
            count += 1
        else:
            count += 1

        i = i - 1
    return(sel)

def reverse(number_list):
    result = 0
    count = 60
    for i in range(61):
        result += number_list[i] * 2**count
        count = count - 1
    return(result)


def calculate(num1,num2):
    numa = trans(num1)
    numb = trans(num2)
    result = [0 for i in range(61)]
    for i in range(61):
        if(numa[i] != numb[i]):
            result[i] = 1
    return(reverse(result))


num = int(input())

point = input().split(' ')

for i in range(num):
    point[i] = int(point[i])

result = 0
for i in range(num - 1):
    for l in range(num - i - 1):
        result += calculate(point[i],point[i + l + 1])

print(result % (10**9 + 7))
