from pprint import pprint
import sys
 
n = int(sys.stdin.readline().strip())
a = map(int, sys.stdin.readline().strip().split(" "))

zero_count = [0] * 60
for a_i in a:
    binary = format(a_i, '060b')
    # print(format(a_i, '030b'))
    for i, bit in enumerate(binary):
        zero_count[i] += int(bit)

# pprint(zero_count)

ans = 0
for i, count in enumerate(zero_count[::-1]):
    # print(i, count)
    ans += ((2 ** i) % (10**9 + 7)) * (count * (n - count))
    ans %= 10**9 + 7 
    # print(ans)

print(ans)