# C - Green Bin

def main():

    count = 0

    dictCount = {}

    for i in [eval(input()) for i in range(int(eval(input())))]:

        strInput = ''.join(sorted([c for c in i]))

        if strInput in dictCount:

            count += dictCount[strInput]

            dictCount[strInput] += 1

        else:

            dictCount[strInput] = 1

    print(count)



if __name__ == "__main__":

    main()

    
# C - Green Bin

def main():

    count = 0

    dictCount = {}

    for i in [eval(input()) for i in range(int(eval(input())))]:

        strInput = ''.join(sorted(i))

        if strInput in dictCount:

            count += dictCount[strInput]

            dictCount[strInput] += 1

        else:

            dictCount[strInput] = 1

    print(count)



if __name__ == "__main__":

    main()

    
# C - Green Bin
def main():
    count = 0
    dictCount = {}
    for i in [eval(input()) for i in range(int(eval(input())))]:
        strInput = "".join(sorted([c for c in i]))
        if strInput in dictCount:
            count += dictCount[strInput]
            dictCount[strInput] += 1
        else:
            dictCount[strInput] = 1
    print(count)


if __name__ == "__main__":
    main()

# C - Green Bin
def main():
    count = 0
    dictCount = {}
    for i in [eval(input()) for i in range(int(eval(input())))]:
        strInput = "".join(sorted(i))
        if strInput in dictCount:
            count += dictCount[strInput]
            dictCount[strInput] += 1
        else:
            dictCount[strInput] = 1
    print(count)


if __name__ == "__main__":
    main()

-        strInput = "".join(sorted([c for c in i])) +        strInput = "".join(sorted(i))