from collections import Counter



n = int(eval(input()))

count = 0

lists =[]

count_dict = Counter()



for i in range(n):

    input_data = ''.join(sorted(eval(input())))

    if input_data in count_dict:

        count += count_dict[input_data]

        count_dict[input_data] += 1

    else:

        count_dict[input_data] = 1



print(count)
def main():

    n = int(eval(input()))

    count = 0

    count_dict = {}



    for i in range(n):

        input_data = ''.join(sorted(eval(input())))

        if input_data in count_dict:

            count += count_dict[input_data]

            count_dict[input_data] += 1

        else:

            count_dict[input_data] = 1



    print(count)





if __name__ == '__main__' :

    main()
from collections import Counter

n = int(eval(input()))
count = 0
lists = []
count_dict = Counter()
for i in range(n):
    input_data = "".join(sorted(eval(input())))
    if input_data in count_dict:
        count += count_dict[input_data]
        count_dict[input_data] += 1
    else:
        count_dict[input_data] = 1
print(count)

def main():
    n = int(eval(input()))
    count = 0
    count_dict = {}
    for i in range(n):
        input_data = "".join(sorted(eval(input())))
        if input_data in count_dict:
            count += count_dict[input_data]
            count_dict[input_data] += 1
        else:
            count_dict[input_data] = 1
    print(count)


if __name__ == "__main__":
    main()

-from collections import Counter +def main(): +    n = int(eval(input())) +    count = 0 +    count_dict = {} +    for i in range(n): +        input_data = "".join(sorted(eval(input()))) +        if input_data in count_dict: +            count += count_dict[input_data] +            count_dict[input_data] += 1 +        else: +            count_dict[input_data] = 1 +    print(count) -n = int(eval(input())) -count = 0 -lists = [] -count_dict = Counter() -for i in range(n): -    input_data = "".join(sorted(eval(input()))) -    if input_data in count_dict: -        count += count_dict[input_data] -        count_dict[input_data] += 1 -    else: -        count_dict[input_data] = 1 -print(count) + +if __name__ == "__main__": +    main()