from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
from decimal import Decimal
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = inpl()
lmx = 0
for i in range(n):
    tmp = bin(a[i])
    a[i] = tmp[2:]
    a[i] = a[i][::-1]
    lmx = max(lmx, len(tmp)-2)
res = 0
cnt = [[0,0] for _ in range(lmx)]
for i in range(n):
    bi = a[i]
    ln = len(bi)
    for j in range(lmx):
        if j < ln:
            cnt[j][int(bi[j])] += 1
        else:
            cnt[j][0] += 1
for i,bit in enumerate(cnt):
    x,y = bit
    res += x*y*pow(2,i)
    res %= mod
print(res)