from math import log2,ceil
from collections import defaultdict
import sys
input=sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
cnt=defaultdict(lambda :0)

for i in range(n):
    temp=a[i]
    if temp==0:continue
    digit=log2(temp)
    for j in range(ceil(digit)+1):
        if (temp>>j)&1:
            cnt[j]+=1

#print(cnt)
ans=0
for digit,count in cnt.items():
    ans+=pow(2,digit)*count*(n-count)
print(ans%mod)