import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int n = sc.nextInt();
       
        ArrayList<String> sList = new ArrayList<>();
      
		for (int i = 0; i < n; i++) {
          String s = sc.next();
          String[] chars = s.split("");
          Arrays.sort(chars);
          String master = "";
          for (String part : chars) {
            master += part;
          }
          sList.add(master);
        }
        Collections.sort(sList);
       
        long ans = 0;
        while (sList.size() > 1) {
          String sample = sList.get(0);
          sList.remove(0);
          long count = 0;
          while(sList.get(0).equals(sample)) {
            ans++;
            count++;
            sList.remove(0);
            if (count > 1) {
            ans += count - 1;
            }
            if (sList.size() == 0) {
              break;
            }
          }
        }      
    
		// 出力
		System.out.println(ans);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int n = sc.nextInt();
       
        ArrayList<String> sList = new ArrayList<>();
      
		for (int i = 0; i < n; i++) {
          String s = sc.next();
          String[] chars = s.split("");
          Arrays.sort(chars);
          String master = "";
          for (String part : chars) {
            master += part;
          }
          sList.add(master);
        }
        Collections.sort(sList);
       
        long ans = 0;
        while (sList.size() > 1) {
          String sample = sList.get(0);
          sList.remove(0);
          long count = 0;
          while(sList.get(0).equals(sample)) {
            ans++;
            count++;
            sList.remove(0);
            if (count > 1) {
            ans += count - 1;
            }
            if (sList.size() == 0) {
              break;
            }
          }
        }      
    
		// 出力
		System.out.println(ans);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int n = sc.nextInt();
       
        ArrayList<String> sList = new ArrayList<>();
      
		for (int i = 0; i < n; i++) {
          String s = sc.next();
          String[] chars = s.split("");
          Arrays.sort(chars);
          String master = "";
          for (String part : chars) {
            master += part;
          }
          sList.add(master);
        }
        Collections.sort(sList);
       
        long ans = 0;
        while (sList.size() > 1) {
          String sample = sList.get(0);
          sList.remove(0);
          long count = 0;
          while(sList.get(0).equals(sample)) {
            ans++;
            count++;
            sList.remove(0);
            if (count > 1) {
            ans += count - 1;
            }
            if (sList.size() == 0) {
              break;
            }
          }
        }      
    
		// 出力
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int n = sc.nextInt();
       
        ArrayList<String> sList = new ArrayList<>();
      
		for (int i = 0; i < n; i++) {
          String s = sc.next();
          String[] chars = s.split("");
          Arrays.sort(chars);
          String master = "";
          for (String part : chars) {
            master += part;
          }
          sList.add(master);
        }
        Collections.sort(sList);
       
        long ans = 0;
        while (sList.size() > 1) {
          String sample = sList.get(0);
          sList.remove(0);
          long count = 0;
          while(sList.get(0).equals(sample)) {
            ans++;
            count++;
            sList.remove(0);
            if (count > 1) {
            ans += count - 1;
            }
            if (sList.size() == 0) {
              break;
            }
          }
        }      
    
		// 出力
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc ArrayList<String> sList = new ArrayList<>(); sList new ArrayList<>() for (int i = 0; i < n; i++) {
          String s = sc.next();
          String[] chars = s.split("");
          Arrays.sort(chars);
          String master = "";
          for (String part : chars) {
            master += part;
          }
          sList.add(master);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
          String s = sc.next();
          String[] chars = s.split("");
          Arrays.sort(chars);
          String master = "";
          for (String part : chars) {
            master += part;
          }
          sList.add(master);
        } {
          String s = sc.next();
          String[] chars = s.split("");
          Arrays.sort(chars);
          String master = "";
          for (String part : chars) {
            master += part;
          }
          sList.add(master);
        } String s = sc.next(); s sc.next() sc.next sc String[] chars = s.split(""); chars s.split("") s.split s "" Arrays.sort(chars) Arrays.sort Arrays chars String master = ""; master "" for (String part : chars) {
            master += part;
          } String part chars {
            master += part;
          } {
            master += part;
          } master += part master part sList.add(master) sList.add sList master Collections.sort(sList) Collections.sort Collections sList long ans = 0; ans 0 while (sList.size() > 1) {
          String sample = sList.get(0);
          sList.remove(0);
          long count = 0;
          while(sList.get(0).equals(sample)) {
            ans++;
            count++;
            sList.remove(0);
            if (count > 1) {
            ans += count - 1;
            }
            if (sList.size() == 0) {
              break;
            }
          }
        } sList.size() > 1 sList.size() sList.size sList 1 {
          String sample = sList.get(0);
          sList.remove(0);
          long count = 0;
          while(sList.get(0).equals(sample)) {
            ans++;
            count++;
            sList.remove(0);
            if (count > 1) {
            ans += count - 1;
            }
            if (sList.size() == 0) {
              break;
            }
          }
        } String sample = sList.get(0); sample sList.get(0) sList.get sList 0 sList.remove(0) sList.remove sList 0 long count = 0; count 0 while(sList.get(0).equals(sample)) {
            ans++;
            count++;
            sList.remove(0);
            if (count > 1) {
            ans += count - 1;
            }
            if (sList.size() == 0) {
              break;
            }
          } sList.get(0).equals(sample) sList.get(0).equals sList.get(0) sList.get sList 0 sample {
            ans++;
            count++;
            sList.remove(0);
            if (count > 1) {
            ans += count - 1;
            }
            if (sList.size() == 0) {
              break;
            }
          } ans++ ans count++ count sList.remove(0) sList.remove sList 0 if (count > 1) {
            ans += count - 1;
            } count > 1 count 1 {
            ans += count - 1;
            } ans += count - 1 ans count - 1 count 1 if (sList.size() == 0) {
              break;
            } sList.size() == 0 sList.size() sList.size sList 0 {
              break;
            } break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int n = sc.nextInt();
       
        ArrayList<String> sList = new ArrayList<>();
      
		for (int i = 0; i < n; i++) {
          String s = sc.next();
          String[] chars = s.split("");
          Arrays.sort(chars);
          String master = "";
          for (String part : chars) {
            master += part;
          }
          sList.add(master);
        }
        Collections.sort(sList);
       
        long ans = 0;
        while (sList.size() > 1) {
          String sample = sList.get(0);
          sList.remove(0);
          long count = 0;
          while(sList.get(0).equals(sample)) {
            ans++;
            count++;
            sList.remove(0);
            if (count > 1) {
            ans += count - 1;
            }
            if (sList.size() == 0) {
              break;
            }
          }
        }      
    
		// 出力
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int n = sc.nextInt();
       
        ArrayList<String> sList = new ArrayList<>();
      
		for (int i = 0; i < n; i++) {
          String s = sc.next();
          String[] chars = s.split("");
          Arrays.sort(chars);
          String master = "";
          for (String part : chars) {
            master += part;
          }
          sList.add(master);
        }
        Collections.sort(sList);
       
        long ans = 0;
        while (sList.size() > 1) {
          String sample = sList.get(0);
          sList.remove(0);
          long count = 0;
          while(sList.get(0).equals(sample)) {
            ans++;
            count++;
            sList.remove(0);
            if (count > 1) {
            ans += count - 1;
            }
            if (sList.size() == 0) {
              break;
            }
          }
        }      
    
		// 出力
		System.out.println(ans);
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int n = sc.nextInt();
       
        ArrayList<String> sList = new ArrayList<>();
      
		for (int i = 0; i < n; i++) {
          String s = sc.next();
          String[] chars = s.split("");
          Arrays.sort(chars);
          String master = "";
          for (String part : chars) {
            master += part;
          }
          sList.add(master);
        }
        Collections.sort(sList);
       
        long ans = 0;
        while (sList.size() > 1) {
          String sample = sList.get(0);
          sList.remove(0);
          long count = 0;
          while(sList.get(0).equals(sample)) {
            ans++;
            count++;
            sList.remove(0);
            if (count > 1) {
            ans += count - 1;
            }
            if (sList.size() == 0) {
              break;
            }
          }
        }      
    
		// 出力
		System.out.println(ans);
	}
}