import sys


def main():
    readline = sys.stdin.readline
    N = int(readline())
    li = [-1] + list(map(int, readline().split()))
    S = 0
    p = 10 ** 9 + 7
    for i in range(1, N):
        for j in range(i + 1, N + 1):
            S += (li[i] ^ li[j]) % p
    print(S)


if __name__ == "__main__":
    main()
