using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        int n = Utils.ReadInts()[0];
        string[] s = Utils.ReadStrings(n);

        //string[] s = {"abaaaaaaaa"
        //,"oneplustwo"
        //,"aaaaaaaaba"
        //,"twoplusone"
        //,"aaaabaaaaa" };

        for (int i = 0; i < s.Length; i++)
        {
            char[] ss = s[i].ToArray();
            Array.Sort(ss);
            s[i] = new string(ss);
        }
        Array.Sort(s);
        long sum = 0;
        int cnt = 0;
        string tmp = "";
        foreach(var ss in s)
        {
            if(string.IsNullOrEmpty(tmp) || tmp == ss)
            {
                cnt++;
                tmp = ss;
            }
            else
            {
                for (int i = cnt - 1; i >= 1; i--)
                {
                    sum += i;
                }
                tmp = ss;
                cnt = 1;
            }
        }
       if(cnt > 0)
        {
            for (int i = cnt - 1; i >= 1; i--)
            {
                sum += i;
            }
        }

        Utils.Return(sum);
    }
}

static class Utils
{
    /// <summary>
    /// int入力を取得する
    /// </summary>
    /// <returns></returns>
    public static int[] ReadInts()
    {
        return Console.ReadLine().Split().Select(int.Parse).ToArray();
    }
    /// <summary>
    /// 最初に条件ヒットした配列のindexを取得する
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="source"></param>
    /// <param name="func"></param>
    /// <param name="start"></param>
    /// <returns></returns>
    public static int FindFirstIndex<T>(IList<T> source, Func<T, bool> func, int start)
    {
        for(int i = start; i < source.Count; i++)
        {
            if (func(source[i]))
            {
                return i;
            }
        }
        return -1;
    }
    /// <summary>
    /// Yes or Noの文字列を返却する
    /// </summary>
    /// <param name="result"></param>
    public static void ReturnYesOrNo(bool result)
    {
        Console.WriteLine(result ? "Yes" : "No");
        Console.ReadLine();
    }

    internal static void Return(object result)
    {
        Console.WriteLine(result);
    }
    /// <summary>
    /// コンソール入力を指定回数受け取る
    /// </summary>
    /// <param name="n"></param>
    /// <returns></returns>
    internal static string[] ReadStrings(int n)
    {
        string[] result = new string[n];
        for(int i = 0; i < n; i++)
        {
            result[i] = Console.ReadLine();
        }
        return result;
    }
}
/// <summary>
/// ソートクラス
/// </summary>
class IntDisComparetor : IComparer<int>
{
    public static IComparer<int> Instance { get; } = new IntDisComparetor();
    private IntDisComparetor() { }
    public int Compare(int x, int y)
    {
        return Comparer<int>.Default.Compare(y, x);
    }
}
/// <summary>
/// ソートクラス
/// </summary>
class IntComparetor : IComparer<int>
{
    public static IComparer<int> Instance { get; } = new IntComparetor();
    private IntComparetor() { }
    public int Compare(int x, int y)
    {
        return Comparer<int>.Default.Compare(x, y);
    }
}

Measured memory_bytes: 27840