# -*- coding: utf-8 -*-
n = int(input())
mb = 0b111111111111111111111111111111
a = list(map(lambda x: int(x) ^ mb, input().split()))

rst = 0
mod = 1000000007
for i in range(n-1):
    for j in range(i+1, n):
        tmp = (a[i] ^ a[j])
        rst = (rst + tmp) % mod

print(rst)
