import itertools
def main():
    N = int(input())
    w = [int(x) for x in input().split()]
    x = [balls for balls in itertools.combinations(w, 2)]
    count = [i[0]^i[1] for i in x] 
    print((sum(count) % (10**9+7)))

if __name__ == "__main__":
    main()