def xor(a, b):
    a_ = format(a, 'b')
    b_ = format(b, 'b')
    l = max(len(a_), len(b_))
    a_ = '0'*(l-len(a_)) + a_
    b_ = '0'*(l-len(b_)) + b_
    result = ''
    for x, y in zip(a_, b_):
        if x == y:
            result += '0'
        else:
            result += '1'
    return int(result, 2)

total = 0
N = int(input())
nums = list(map(int, input().split()))
for i in range(len(nums)):
    for j in range(i+1, len(nums)):
        total += xor(nums[i], nums[j])
        
print(total % (10**9 + 7))