MOD = 10**9+7
n = int(input())
s = 0
a = list(map(int, input().split()))
# a = [i%MOD for i in a]
def calc_sum(arr, n): 
    ans = 0
    for i in range(0, n): 
        for j in range(i+1, n):
            ans = ans + (arr[i] ^ arr[j]) 
    return ans 
      
print(calc_sum(a, n)%MOD) 
  