int_i = int(input())
    # int_i = 10
    result = 0
    s_x = input().split(' ')
    # s_x = '3 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820'.split(' ')
    # i_x = list([int(n) for n in s_x])
    for x,y in enumerate(s_x):
        for z in s_x[x:]:
            result += int(bin(int(y) ^ int(z)), 2)
    # for i in range(int_i):
    #     for hoge in i_x[i + 1:]:
    #         if i_x[i] == hoge:
    #             continue
    #         result += int(bin(i_x[i] ^ hoge), 2)
    print(result % (10 ** 9 + 7))