### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def resolve():
    readline=sys.stdin.readline
    mod=10**9+7
    n=int(readline())
    arr=list(map(int, readline().rstrip().split()))
    cnt=[0]*60
    for i in range(n):
        b = bin(arr[i])
        j = -1
        while b[j]!="b":
            if b[j]=="1":
                k=j*-1 -1
                cnt[k]+=1
            j-=1

    ans=[0]*60
    answer = 0
    for i in range(60):
        ans[i]=cnt[i] * (n-cnt[i])
    x=1
    for i in range(60):
        answer += ans[i]*x
        answer %= mod
        x*=2
        x%=mod
    print(answer)
    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------