import sys
from pprint import pprint

def pow_r(x, n):
    """
    O(log n)
    """
    if n == 0:  # exit case
        return 1
    if n % 2 == 0:
        return pow_r(x ** 2, n // 2) % (10**9 + 7)
    else:
        return (x * pow_r(x ** 2, (n - 1) // 2)) % (10**9 + 7)


def solve(n, a):

    zero_count = [0] * 60
    for a_i in a:
        binary = format(a_i, '060b')

        for j, b_j in enumerate(binary):
            zero_count[j] += int(b_j)

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

if __name__ == '__main__':
    n = int(sys.stdin.readline().strip())
    a = map(int, sys.stdin.readline().strip().split(" "))
    
    solve(n, a)