import itertools

MOD = 10**9 + 7
N = int(input())
A = [int(i) for i in input().split()]


def main():
    ans = sum([a ^ b for (a, b) in itertools.combinations(A, 2)]) % MOD
    print(ans)


if __name__ == '__main__':
    main()
