import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    Map<String, Integer> s = new HashMap<String, Integer>();
    char[] c;
    String ds;
    long ans = 0;
    int tmp;
    for (int i=0;i<n;i++){
      c = sc.next().toCharArray();
      Arrays.sort(c);
      ds = String.valueOf(c);
      tmp = s.getOrDefault(ds,0);
      ans += tmp;
      s.put(ds,tmp+1);
    }
    sc.close();
    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();
    Map<String, Integer> s = new HashMap<String, Integer>();
    char[] c;
    String ds;
    long ans = 0;
    int tmp;
    for (int i=0;i<n;i++){
      c = sc.next().toCharArray();
      Arrays.sort(c);
      ds = String.valueOf(c);
      tmp = s.getOrDefault(ds,0);
      ans += tmp;
      s.put(ds,tmp+1);
    }
    sc.close();
    System.out.println(ans);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    Map<String, Integer> s = new HashMap<String, Integer>();
    char[] c;
    String ds;
    long ans = 0;
    int tmp;
    for (int i=0;i<n;i++){
      c = sc.next().toCharArray();
      Arrays.sort(c);
      ds = String.valueOf(c);
      tmp = s.getOrDefault(ds,0);
      ans += tmp;
      s.put(ds,tmp+1);
    }
    sc.close();
    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    Map<String, Integer> s = new HashMap<String, Integer>();
    char[] c;
    String ds;
    long ans = 0;
    int tmp;
    for (int i=0;i<n;i++){
      c = sc.next().toCharArray();
      Arrays.sort(c);
      ds = String.valueOf(c);
      tmp = s.getOrDefault(ds,0);
      ans += tmp;
      s.put(ds,tmp+1);
    }
    sc.close();
    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 Map<String, Integer> s = new HashMap<String, Integer>(); s new HashMap<String, Integer>() char[] c; c String ds; ds long ans = 0; ans 0 int tmp; tmp for (int i=0;i<n;i++){
      c = sc.next().toCharArray();
      Arrays.sort(c);
      ds = String.valueOf(c);
      tmp = s.getOrDefault(ds,0);
      ans += tmp;
      s.put(ds,tmp+1);
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      c = sc.next().toCharArray();
      Arrays.sort(c);
      ds = String.valueOf(c);
      tmp = s.getOrDefault(ds,0);
      ans += tmp;
      s.put(ds,tmp+1);
    } {
      c = sc.next().toCharArray();
      Arrays.sort(c);
      ds = String.valueOf(c);
      tmp = s.getOrDefault(ds,0);
      ans += tmp;
      s.put(ds,tmp+1);
    } c = sc.next().toCharArray() c sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc Arrays.sort(c) Arrays.sort Arrays c ds = String.valueOf(c) ds String.valueOf(c) String.valueOf String c tmp = s.getOrDefault(ds,0) tmp s.getOrDefault(ds,0) s.getOrDefault s ds 0 ans += tmp ans tmp s.put(ds,tmp+1) s.put s ds tmp+1 tmp 1 sc.close() sc.close sc 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();
    Map<String, Integer> s = new HashMap<String, Integer>();
    char[] c;
    String ds;
    long ans = 0;
    int tmp;
    for (int i=0;i<n;i++){
      c = sc.next().toCharArray();
      Arrays.sort(c);
      ds = String.valueOf(c);
      tmp = s.getOrDefault(ds,0);
      ans += tmp;
      s.put(ds,tmp+1);
    }
    sc.close();
    System.out.println(ans);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    Map<String, Integer> s = new HashMap<String, Integer>();
    char[] c;
    String ds;
    long ans = 0;
    int tmp;
    for (int i=0;i<n;i++){
      c = sc.next().toCharArray();
      Arrays.sort(c);
      ds = String.valueOf(c);
      tmp = s.getOrDefault(ds,0);
      ans += tmp;
      s.put(ds,tmp+1);
    }
    sc.close();
    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();
    Map<String, Integer> s = new HashMap<String, Integer>();
    char[] c;
    String ds;
    long ans = 0;
    int tmp;
    for (int i=0;i<n;i++){
      c = sc.next().toCharArray();
      Arrays.sort(c);
      ds = String.valueOf(c);
      tmp = s.getOrDefault(ds,0);
      ans += tmp;
      s.put(ds,tmp+1);
    }
    sc.close();
    System.out.println(ans);
  }
}