N = int(input())
A = list(map(int, input().split()))

from itertools import combinations
# ["a", "b", "c"] から 2 つ選ぶ組み合わせをすべて列挙する

count = 0
for t in combinations(A, 2):
  count += t[0]^t[1]
print(count%(10**9+7))