import itertools

N = int(input())
MOD = 1000000007
nums = list(map(int, input().split(' ')))
MASK = 2**34-1
nums = map(lambda x: x & MASK, nums)

ret = 0
combi = itertools.combinations(nums, 2)
for x, y in combi:
  ret = (ret + (x ^ y))% MOD
print(ret)

