#!/usr/bin/env python3

import itertools

mod = 10**9+7

n = int(input())
a = list(map(int, input().split()))

ans = 0
for x, y in itertools.combinations(a, 2):
    # print(x ^ y)
    ans += (x ^ y)

print(ans % mod)
