import numpy as np

N = int(input())
A = list(input().split())
d_to_num1 = {}
len_a = []
for i in range(N):
    a = list(bin(int(A[i]))[2:])
    len_a.append(len(a))
    for j,b in enumerate(reversed(a)):
        if b=='1':
            if not(j in d_to_num1.keys()):
                d_to_num1[j]=1
            else:
                d_to_num1[j]+=1 
max_len = max(len_a)
        
if __name__ == "__main__":

    res = 0
    mod = 10**9+7

    for i in range(max_len):
        if not(i in d_to_num1.keys()):
            num_1 = 0
        else:
            num_1 = d_to_num1[i]
        num_0 = N-num_1
        tmp = 1
        tmp = tmp*num_0%mod
        tmp = tmp*num_1%mod
        for _ in range(i):
            tmp = tmp*2%mod
        res = (res+tmp)%mod
    print(res)