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