#!/usr/bin/env python3
# -*- coding: utf-8 -*-

n = int(input())
a = [int(i) for i in input().split()]

k = [0] * 60

for j in range(60):
    l = [i >> j & 1 for i in a]
    for m in l:
        k[j] += m
    a = l

ans = 0
c = 0
for d in k:
    ans += (d * (n - d) * 2**c)  % (10**9 + 7)
    c += 1
    
print(ans % (10**9 + 7))