'''input
3 5
1 2 1
2 3 0
'''
# connected components
from sys import stdin, setrecursionlimit
from bisect import bisect_left
import sys, threading
from collections import defaultdict


def power(a, x, mod):
    if x == 0:
        return 1
    temp = power(a, x//2, mod) % mod
    if x % 2:
        return ((temp * temp) % mod * a) % mod
    else:
        return ((temp * temp)% mod)


# main starts
n = int(stdin.readline().strip())
arr = list(map(int, stdin.readline().split()))
ans = 0
mod = 10 ** 9 + 7
for i in range(60):
    num = 1 << i
    count = 0
    for k in range(n):
        if num & arr[k] == 0:
            count += 1
    # print(num, count, n - count)
    ans += (power(2, i, mod) *(count * (n - count)) % mod) % mod
    ans %= mod
print(ans)