# -*- coding: utf-8 -*-
# D

import sys
# 再起回数上限変更
# sys.setrecursionlimit(1000000)

N = int(input())
a = list(map(int, input().split()))

l = [0] * 60

for a in a:
    temp = bin(a)[2:][::-1]
    # print(temp)
    for i in range(60):
        if i < len(temp):
            l[i] += int(temp[i])
        else:
            l[i] += 0

# print(l)

ans = 0
mod = 10**9 + 7

for i in range(60):
    ans += ((2**i) % mod) * l[i] * (N-l[i])
    ans = ans % mod

print(ans)
