n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
    b.append(format(a[i],"b"))
ans = 0
def func(num):
    global ans
    flag = False
    one_count = 0
    zero_count = 0
    for i in range(n):
        if len(b[i]) > num:
            flag = True
            if b[i][-1*(num+1)] == "1":
                one_count += 1
            else:
                zero_count += 1
        else:
            zero_count += 1
    if flag:
        ans += one_count * zero_count * (2** num)
        func(num+1)
func(0)
print(ans%(10**9+7))