# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
base = 10**9+7
sum = 0
for i in range(1, n):
    for j in range(i+1, n+1):
        l = a[i-1] ^ a[j-1]
        sum += l
    sum %= base

print(sum)

