import itertools
def main():
    S = int(input())
    a = [int(i) for i in input().split()]
    
    xor = 0
    patern = list(itertools.combinations(a, 2))
    for p in patern:
        xor += p[0] ^ p[1]
    if xor >= 10 ** 9:
        print(xor % (10 ** 9 + 7))
    else:
        print(xor)

if __name__ == '__main__':
    main()