#147d
import itertools

N = int(input())
A_list = [int(e) for e in input().split()]

MOD_BY = 7 + 10**9

#愚直解
ans = 0

for i in range(len(A_list)-1):
    temp_ans = 0
    for j in range(i + 1,len(A_list)):
        temp_ans += A_list[i]^A_list[j]
    
print(ans%MOD_BY)