def main():
    N = int(input())
    a_list = list(map(int, input().split()))

    sum = 0
    for i in range(N):
        for j in range(i+1, N):
           sum += a_list[i] ^ a_list[j]

    print(sum % (10**9+7))


if __name__ == '__main__':
    main()