n = int(input())
a = [num for num in map(int, input().split())]

ans = 0
for i in range(n-1):
  for j in range(i+1, n):
    # print(a[i], a[j], a[i]^a[j])
    ans += a[i] ^ a[j]
print(ans % (10 ** 9 + 7))