# from math import sqrt
# from heapq import heappush, heappop
# from collections import deque
# from functools import reduce

# a, b = [int(v) for v in input().split()]


def main():
    mod = 1000000007
    N = int(input())
    A = [int(v) for v in input().split()]

    total = 0
    for i, ai in enumerate(A):
        for aj in A[i+1:]:
            total += (ai ^ aj) % mod
    print(total % mod)


main()
