n=int(input())
lists=list(map(int,input().split()))
length=61
use=[0 for i in range(61)]
for  j in range(n):
    k=format(lists[j],"0%ib"%length)
    k=k[::-1]
    for some in range(len(k)):
        use[some]+=int(k[some])
answer=0
for j in range(61):
    answer+=(2**j)*use[j]*(n-use[j])%(10**9+7)
print(answer%(10**9+7))