import itertools


input()
nums = [int(i) for i in input().split(" ")]
longest = len(bin(max(nums))) - 2
nums_bin = [format(i, "b").zfill(longest) for i in nums]


result = 0
for i in range(1, longest+1):
    one = 0
    zero = 0
    for num_bin in nums_bin:
        if num_bin[-1*i] == "1":
            one += 1
        elif num_bin[-1*i] == "0":
            zero += 1
        else:
            raise Exception()
    result += (2 ** (i-1)) * (one * zero)
print(result % (10 ** 9 + 7))