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

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

k = [0] * 60

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

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