N = int(input())
List = list(map(int, input().split()))
sum = 0
for i in range(len(List)):
    for j in range(len(List)):
        if i >= j:
            continue
        else:
            sum += List[i] ^ List[j]
print(sum % (10**9+7))