import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        Long output = new Long("0");
        Hashtable<String,Long> ht = new Hashtable<String,Long>();
		// 整数の入力
		int N = sc.nextInt();
		for(int i = 1; i <= N; i++){
          char[] tmp = sc.next().toCharArray();
          Arrays.sort(tmp);
          String tmp2 = new String(tmp);
          if(ht.get(tmp2) == null){
            ht.put(tmp2,new Long("1"));
          }else{
            output += ht.get(tmp2);
            ht.put(tmp2,ht.get(tmp2) + 1);
          }
        }
		System.out.println(output);
		
		// 出力
		
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        Long output = new Long("0");
        Hashtable<String,Long> ht = new Hashtable<String,Long>();
		// 整数の入力
		int N = sc.nextInt();
		for(int i = 1; i <= N; i++){
          char[] tmp = sc.next().toCharArray();
          Arrays.sort(tmp);
          String tmp2 = new String(tmp);
          if(ht.get(tmp2) == null){
            ht.put(tmp2,new Long("1"));
          }else{
            output += ht.get(tmp2);
            ht.put(tmp2,ht.get(tmp2) + 1);
          }
        }
		System.out.println(output);
		
		// 出力
		
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        Long output = new Long("0");
        Hashtable<String,Long> ht = new Hashtable<String,Long>();
		// 整数の入力
		int N = sc.nextInt();
		for(int i = 1; i <= N; i++){
          char[] tmp = sc.next().toCharArray();
          Arrays.sort(tmp);
          String tmp2 = new String(tmp);
          if(ht.get(tmp2) == null){
            ht.put(tmp2,new Long("1"));
          }else{
            output += ht.get(tmp2);
            ht.put(tmp2,ht.get(tmp2) + 1);
          }
        }
		System.out.println(output);
		
		// 出力
		
	} main {
		Scanner sc = new Scanner(System.in);
        Long output = new Long("0");
        Hashtable<String,Long> ht = new Hashtable<String,Long>();
		// 整数の入力
		int N = sc.nextInt();
		for(int i = 1; i <= N; i++){
          char[] tmp = sc.next().toCharArray();
          Arrays.sort(tmp);
          String tmp2 = new String(tmp);
          if(ht.get(tmp2) == null){
            ht.put(tmp2,new Long("1"));
          }else{
            output += ht.get(tmp2);
            ht.put(tmp2,ht.get(tmp2) + 1);
          }
        }
		System.out.println(output);
		
		// 出力
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Long output = new Long("0"); output new Long("0") Hashtable<String,Long> ht = new Hashtable<String,Long>(); ht new Hashtable<String,Long>() int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc for(int i = 1; i <= N; i++){
          char[] tmp = sc.next().toCharArray();
          Arrays.sort(tmp);
          String tmp2 = new String(tmp);
          if(ht.get(tmp2) == null){
            ht.put(tmp2,new Long("1"));
          }else{
            output += ht.get(tmp2);
            ht.put(tmp2,ht.get(tmp2) + 1);
          }
        } int i = 1; int i = 1; i 1 i <= N i N i++ i++ i {
          char[] tmp = sc.next().toCharArray();
          Arrays.sort(tmp);
          String tmp2 = new String(tmp);
          if(ht.get(tmp2) == null){
            ht.put(tmp2,new Long("1"));
          }else{
            output += ht.get(tmp2);
            ht.put(tmp2,ht.get(tmp2) + 1);
          }
        } {
          char[] tmp = sc.next().toCharArray();
          Arrays.sort(tmp);
          String tmp2 = new String(tmp);
          if(ht.get(tmp2) == null){
            ht.put(tmp2,new Long("1"));
          }else{
            output += ht.get(tmp2);
            ht.put(tmp2,ht.get(tmp2) + 1);
          }
        } char[] tmp = sc.next().toCharArray(); tmp sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc Arrays.sort(tmp) Arrays.sort Arrays tmp String tmp2 = new String(tmp); tmp2 new String(tmp) if(ht.get(tmp2) == null){
            ht.put(tmp2,new Long("1"));
          }else{
            output += ht.get(tmp2);
            ht.put(tmp2,ht.get(tmp2) + 1);
          } ht.get(tmp2) == null ht.get(tmp2) ht.get ht tmp2 null {
            ht.put(tmp2,new Long("1"));
          } ht.put(tmp2,new Long("1")) ht.put ht tmp2 new Long("1") {
            output += ht.get(tmp2);
            ht.put(tmp2,ht.get(tmp2) + 1);
          } output += ht.get(tmp2) output ht.get(tmp2) ht.get ht tmp2 ht.put(tmp2,ht.get(tmp2) + 1) ht.put ht tmp2 ht.get(tmp2) + 1 ht.get(tmp2) ht.get ht tmp2 1 System.out.println(output) System.out.println System.out System System.out output String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        Long output = new Long("0");
        Hashtable<String,Long> ht = new Hashtable<String,Long>();
		// 整数の入力
		int N = sc.nextInt();
		for(int i = 1; i <= N; i++){
          char[] tmp = sc.next().toCharArray();
          Arrays.sort(tmp);
          String tmp2 = new String(tmp);
          if(ht.get(tmp2) == null){
            ht.put(tmp2,new Long("1"));
          }else{
            output += ht.get(tmp2);
            ht.put(tmp2,ht.get(tmp2) + 1);
          }
        }
		System.out.println(output);
		
		// 出力
		
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        Long output = new Long("0");
        Hashtable<String,Long> ht = new Hashtable<String,Long>();
		// 整数の入力
		int N = sc.nextInt();
		for(int i = 1; i <= N; i++){
          char[] tmp = sc.next().toCharArray();
          Arrays.sort(tmp);
          String tmp2 = new String(tmp);
          if(ht.get(tmp2) == null){
            ht.put(tmp2,new Long("1"));
          }else{
            output += ht.get(tmp2);
            ht.put(tmp2,ht.get(tmp2) + 1);
          }
        }
		System.out.println(output);
		
		// 出力
		
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        Long output = new Long("0");
        Hashtable<String,Long> ht = new Hashtable<String,Long>();
		// 整数の入力
		int N = sc.nextInt();
		for(int i = 1; i <= N; i++){
          char[] tmp = sc.next().toCharArray();
          Arrays.sort(tmp);
          String tmp2 = new String(tmp);
          if(ht.get(tmp2) == null){
            ht.put(tmp2,new Long("1"));
          }else{
            output += ht.get(tmp2);
            ht.put(tmp2,ht.get(tmp2) + 1);
          }
        }
		System.out.println(output);
		
		// 出力
		
	}
}