import java.util.*;
public class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner (System.in);
    long N = sc.nextInt();
    ArrayList<String> list = new ArrayList<String>();
    for (int i=0; i<N; i++) {
      char[] c = sc.next().toCharArray();
      Arrays.sort(c);
      String s = new String(c);
      list.add(s);
    }
    Collections.sort(list);
    long ans = 0;
    long count = 1;
    
    for (int i=0; i<N-1; i++) {
      if (list.get(i).equals(list.get(i+1))) {
        count++;
        if (i == N-2) {
          ans += count*(count-1)/2;
        }
      }
      else {
        ans += count*(count-1)/2;
        count = 1;
      }
      
    }
    
    System.out.println(ans);
    
  }
} import java.util.*; util.* java public class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner (System.in);
    long N = sc.nextInt();
    ArrayList<String> list = new ArrayList<String>();
    for (int i=0; i<N; i++) {
      char[] c = sc.next().toCharArray();
      Arrays.sort(c);
      String s = new String(c);
      list.add(s);
    }
    Collections.sort(list);
    long ans = 0;
    long count = 1;
    
    for (int i=0; i<N-1; i++) {
      if (list.get(i).equals(list.get(i+1))) {
        count++;
        if (i == N-2) {
          ans += count*(count-1)/2;
        }
      }
      else {
        ans += count*(count-1)/2;
        count = 1;
      }
      
    }
    
    System.out.println(ans);
    
  }
} Main public static void main (String[] args) {
    Scanner sc = new Scanner (System.in);
    long N = sc.nextInt();
    ArrayList<String> list = new ArrayList<String>();
    for (int i=0; i<N; i++) {
      char[] c = sc.next().toCharArray();
      Arrays.sort(c);
      String s = new String(c);
      list.add(s);
    }
    Collections.sort(list);
    long ans = 0;
    long count = 1;
    
    for (int i=0; i<N-1; i++) {
      if (list.get(i).equals(list.get(i+1))) {
        count++;
        if (i == N-2) {
          ans += count*(count-1)/2;
        }
      }
      else {
        ans += count*(count-1)/2;
        count = 1;
      }
      
    }
    
    System.out.println(ans);
    
  } main {
    Scanner sc = new Scanner (System.in);
    long N = sc.nextInt();
    ArrayList<String> list = new ArrayList<String>();
    for (int i=0; i<N; i++) {
      char[] c = sc.next().toCharArray();
      Arrays.sort(c);
      String s = new String(c);
      list.add(s);
    }
    Collections.sort(list);
    long ans = 0;
    long count = 1;
    
    for (int i=0; i<N-1; i++) {
      if (list.get(i).equals(list.get(i+1))) {
        count++;
        if (i == N-2) {
          ans += count*(count-1)/2;
        }
      }
      else {
        ans += count*(count-1)/2;
        count = 1;
      }
      
    }
    
    System.out.println(ans);
    
  } Scanner sc = new Scanner (System.in); sc new Scanner (System.in) long N = sc.nextInt(); N sc.nextInt() sc.nextInt sc ArrayList<String> list = new ArrayList<String>(); list new ArrayList<String>() for (int i=0; i<N; i++) {
      char[] c = sc.next().toCharArray();
      Arrays.sort(c);
      String s = new String(c);
      list.add(s);
    } int i=0; int i=0; i 0 i<N i N i++ i++ i {
      char[] c = sc.next().toCharArray();
      Arrays.sort(c);
      String s = new String(c);
      list.add(s);
    } {
      char[] c = sc.next().toCharArray();
      Arrays.sort(c);
      String s = new String(c);
      list.add(s);
    } char[] c = sc.next().toCharArray(); c sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc Arrays.sort(c) Arrays.sort Arrays c String s = new String(c); s new String(c) list.add(s) list.add list s Collections.sort(list) Collections.sort Collections list long ans = 0; ans 0 long count = 1; count 1 for (int i=0; i<N-1; i++) {
      if (list.get(i).equals(list.get(i+1))) {
        count++;
        if (i == N-2) {
          ans += count*(count-1)/2;
        }
      }
      else {
        ans += count*(count-1)/2;
        count = 1;
      }
      
    } int i=0; int i=0; i 0 i<N-1 i N-1 N 1 i++ i++ i {
      if (list.get(i).equals(list.get(i+1))) {
        count++;
        if (i == N-2) {
          ans += count*(count-1)/2;
        }
      }
      else {
        ans += count*(count-1)/2;
        count = 1;
      }
      
    } {
      if (list.get(i).equals(list.get(i+1))) {
        count++;
        if (i == N-2) {
          ans += count*(count-1)/2;
        }
      }
      else {
        ans += count*(count-1)/2;
        count = 1;
      }
      
    } if (list.get(i).equals(list.get(i+1))) {
        count++;
        if (i == N-2) {
          ans += count*(count-1)/2;
        }
      }
      else {
        ans += count*(count-1)/2;
        count = 1;
      } list.get(i).equals(list.get(i+1)) list.get(i).equals list.get(i) list.get list i list.get(i+1) list.get list i+1 i 1 {
        count++;
        if (i == N-2) {
          ans += count*(count-1)/2;
        }
      } count++ count if (i == N-2) {
          ans += count*(count-1)/2;
        } i == N-2 i N-2 N 2 {
          ans += count*(count-1)/2;
        } ans += count*(count-1)/2 ans count*(count-1)/2 count*(count-1) count (count-1) count 1 2 {
        ans += count*(count-1)/2;
        count = 1;
      } ans += count*(count-1)/2 ans count*(count-1)/2 count*(count-1) count (count-1) count 1 2 count = 1 count 1 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);
    long N = sc.nextInt();
    ArrayList<String> list = new ArrayList<String>();
    for (int i=0; i<N; i++) {
      char[] c = sc.next().toCharArray();
      Arrays.sort(c);
      String s = new String(c);
      list.add(s);
    }
    Collections.sort(list);
    long ans = 0;
    long count = 1;
    
    for (int i=0; i<N-1; i++) {
      if (list.get(i).equals(list.get(i+1))) {
        count++;
        if (i == N-2) {
          ans += count*(count-1)/2;
        }
      }
      else {
        ans += count*(count-1)/2;
        count = 1;
      }
      
    }
    
    System.out.println(ans);
    
  }
} public class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner (System.in);
    long N = sc.nextInt();
    ArrayList<String> list = new ArrayList<String>();
    for (int i=0; i<N; i++) {
      char[] c = sc.next().toCharArray();
      Arrays.sort(c);
      String s = new String(c);
      list.add(s);
    }
    Collections.sort(list);
    long ans = 0;
    long count = 1;
    
    for (int i=0; i<N-1; i++) {
      if (list.get(i).equals(list.get(i+1))) {
        count++;
        if (i == N-2) {
          ans += count*(count-1)/2;
        }
      }
      else {
        ans += count*(count-1)/2;
        count = 1;
      }
      
    }
    
    System.out.println(ans);
    
  }
} Main
import java.util.*;
public class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner (System.in);
    long N = sc.nextInt();
    ArrayList<String> list = new ArrayList<String>();
    for (int i=0; i<N; i++) {
      char[] c = sc.next().toCharArray();
      Arrays.sort(c);
      String s = new String(c);
      list.add(s);
    }
    Collections.sort(list);
    long ans = 0;
    long count = 1;
    
    for (int i=0; i<N-1; i++) {
      if (list.get(i).equals(list.get(i+1))) {
        count++;
        if (i == N-2) {
          ans += count*(count-1)/2;
        }
      }
      else {
        ans += count*(count-1)/2;
        count = 1;
      }
      
    }
    
    System.out.println(ans);
    
  }
}