s = input().split()
n=int(s[0])
s = input().split()
ans = 0
for i in range(len(bin(int(max(s))))-2):
    count_0=0
    count_1=0
    for j in s:
        if len(bin(int(j)))>i+2:
            if bin(int(j))[len(bin(int(j)))-1-i] == '0':
                count_0+=1
            else:
                count_1+=1
        else:
            count_0+=1
    ans+=(count_0*count_1)*2**i

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