def main():
    length = int(input())
    data = [int(x) for x in input().split()]

    total = 0
    for i in range(length - 1):
        for j in range(i, length):
            total += (data[i] ^ data[j])
    print(total % (10 ** 9 + 7))


if __name__ == "__main__":
    main()
