import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;

public class Main{
  public static void main(String[] args){
    Scanner s = new Scanner(System.in);
    long N = s.nextLong();
    ArrayList<String> str = new ArrayList<String>();
    ArrayList<Character> cha = new ArrayList<Character>();
    long Ans = 0;
    String a = new String();
    for (long i=0;i<N;i++){
      a = s.next();
        for(int j=0;j< a.length();j++){
          cha.add(a.charAt(j));
        }
      Collections.sort(cha);
      a = cha.toString();
      str.add(a);
      cha.clear();
    }
    Collections.sort(str);
    int REN = 0;
    for (int i=0; i<N-1;i++){
      String ha = str.get(i);
      if (ha.equals(str.get(i+1))){
        REN += 1;
        Ans += REN;
      }
      else{
        REN = 0;
      }
    }
    System.out.println(Ans);
  }
} import java.util.Scanner; Scanner java.util import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util public class Main{
  public static void main(String[] args){
    Scanner s = new Scanner(System.in);
    long N = s.nextLong();
    ArrayList<String> str = new ArrayList<String>();
    ArrayList<Character> cha = new ArrayList<Character>();
    long Ans = 0;
    String a = new String();
    for (long i=0;i<N;i++){
      a = s.next();
        for(int j=0;j< a.length();j++){
          cha.add(a.charAt(j));
        }
      Collections.sort(cha);
      a = cha.toString();
      str.add(a);
      cha.clear();
    }
    Collections.sort(str);
    int REN = 0;
    for (int i=0; i<N-1;i++){
      String ha = str.get(i);
      if (ha.equals(str.get(i+1))){
        REN += 1;
        Ans += REN;
      }
      else{
        REN = 0;
      }
    }
    System.out.println(Ans);
  }
} Main public static void main(String[] args){
    Scanner s = new Scanner(System.in);
    long N = s.nextLong();
    ArrayList<String> str = new ArrayList<String>();
    ArrayList<Character> cha = new ArrayList<Character>();
    long Ans = 0;
    String a = new String();
    for (long i=0;i<N;i++){
      a = s.next();
        for(int j=0;j< a.length();j++){
          cha.add(a.charAt(j));
        }
      Collections.sort(cha);
      a = cha.toString();
      str.add(a);
      cha.clear();
    }
    Collections.sort(str);
    int REN = 0;
    for (int i=0; i<N-1;i++){
      String ha = str.get(i);
      if (ha.equals(str.get(i+1))){
        REN += 1;
        Ans += REN;
      }
      else{
        REN = 0;
      }
    }
    System.out.println(Ans);
  } main {
    Scanner s = new Scanner(System.in);
    long N = s.nextLong();
    ArrayList<String> str = new ArrayList<String>();
    ArrayList<Character> cha = new ArrayList<Character>();
    long Ans = 0;
    String a = new String();
    for (long i=0;i<N;i++){
      a = s.next();
        for(int j=0;j< a.length();j++){
          cha.add(a.charAt(j));
        }
      Collections.sort(cha);
      a = cha.toString();
      str.add(a);
      cha.clear();
    }
    Collections.sort(str);
    int REN = 0;
    for (int i=0; i<N-1;i++){
      String ha = str.get(i);
      if (ha.equals(str.get(i+1))){
        REN += 1;
        Ans += REN;
      }
      else{
        REN = 0;
      }
    }
    System.out.println(Ans);
  } Scanner s = new Scanner(System.in); s new Scanner(System.in) long N = s.nextLong(); N s.nextLong() s.nextLong s ArrayList<String> str = new ArrayList<String>(); str new ArrayList<String>() ArrayList<Character> cha = new ArrayList<Character>(); cha new ArrayList<Character>() long Ans = 0; Ans 0 String a = new String(); a new String() for (long i=0;i<N;i++){
      a = s.next();
        for(int j=0;j< a.length();j++){
          cha.add(a.charAt(j));
        }
      Collections.sort(cha);
      a = cha.toString();
      str.add(a);
      cha.clear();
    } long i=0; long i=0; i 0 i<N i N i++ i++ i {
      a = s.next();
        for(int j=0;j< a.length();j++){
          cha.add(a.charAt(j));
        }
      Collections.sort(cha);
      a = cha.toString();
      str.add(a);
      cha.clear();
    } {
      a = s.next();
        for(int j=0;j< a.length();j++){
          cha.add(a.charAt(j));
        }
      Collections.sort(cha);
      a = cha.toString();
      str.add(a);
      cha.clear();
    } a = s.next() a s.next() s.next s for(int j=0;j< a.length();j++){
          cha.add(a.charAt(j));
        } int j=0; int j=0; j 0 j< a.length() j a.length() a.length a j++ j++ j {
          cha.add(a.charAt(j));
        } {
          cha.add(a.charAt(j));
        } cha.add(a.charAt(j)) cha.add cha a.charAt(j) a.charAt a j Collections.sort(cha) Collections.sort Collections cha a = cha.toString() a cha.toString() cha.toString cha str.add(a) str.add str a cha.clear() cha.clear cha Collections.sort(str) Collections.sort Collections str int REN = 0; REN 0 for (int i=0; i<N-1;i++){
      String ha = str.get(i);
      if (ha.equals(str.get(i+1))){
        REN += 1;
        Ans += REN;
      }
      else{
        REN = 0;
      }
    } int i=0; int i=0; i 0 i<N-1 i N-1 N 1 i++ i++ i {
      String ha = str.get(i);
      if (ha.equals(str.get(i+1))){
        REN += 1;
        Ans += REN;
      }
      else{
        REN = 0;
      }
    } {
      String ha = str.get(i);
      if (ha.equals(str.get(i+1))){
        REN += 1;
        Ans += REN;
      }
      else{
        REN = 0;
      }
    } String ha = str.get(i); ha str.get(i) str.get str i if (ha.equals(str.get(i+1))){
        REN += 1;
        Ans += REN;
      }
      else{
        REN = 0;
      } ha.equals(str.get(i+1)) ha.equals ha str.get(i+1) str.get str i+1 i 1 {
        REN += 1;
        Ans += REN;
      } REN += 1 REN 1 Ans += REN Ans REN {
        REN = 0;
      } REN = 0 REN 0 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 s = new Scanner(System.in);
    long N = s.nextLong();
    ArrayList<String> str = new ArrayList<String>();
    ArrayList<Character> cha = new ArrayList<Character>();
    long Ans = 0;
    String a = new String();
    for (long i=0;i<N;i++){
      a = s.next();
        for(int j=0;j< a.length();j++){
          cha.add(a.charAt(j));
        }
      Collections.sort(cha);
      a = cha.toString();
      str.add(a);
      cha.clear();
    }
    Collections.sort(str);
    int REN = 0;
    for (int i=0; i<N-1;i++){
      String ha = str.get(i);
      if (ha.equals(str.get(i+1))){
        REN += 1;
        Ans += REN;
      }
      else{
        REN = 0;
      }
    }
    System.out.println(Ans);
  }
} public class Main{
  public static void main(String[] args){
    Scanner s = new Scanner(System.in);
    long N = s.nextLong();
    ArrayList<String> str = new ArrayList<String>();
    ArrayList<Character> cha = new ArrayList<Character>();
    long Ans = 0;
    String a = new String();
    for (long i=0;i<N;i++){
      a = s.next();
        for(int j=0;j< a.length();j++){
          cha.add(a.charAt(j));
        }
      Collections.sort(cha);
      a = cha.toString();
      str.add(a);
      cha.clear();
    }
    Collections.sort(str);
    int REN = 0;
    for (int i=0; i<N-1;i++){
      String ha = str.get(i);
      if (ha.equals(str.get(i+1))){
        REN += 1;
        Ans += REN;
      }
      else{
        REN = 0;
      }
    }
    System.out.println(Ans);
  }
} Main
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;

public class Main{
  public static void main(String[] args){
    Scanner s = new Scanner(System.in);
    long N = s.nextLong();
    ArrayList<String> str = new ArrayList<String>();
    ArrayList<Character> cha = new ArrayList<Character>();
    long Ans = 0;
    String a = new String();
    for (long i=0;i<N;i++){
      a = s.next();
        for(int j=0;j< a.length();j++){
          cha.add(a.charAt(j));
        }
      Collections.sort(cha);
      a = cha.toString();
      str.add(a);
      cha.clear();
    }
    Collections.sort(str);
    int REN = 0;
    for (int i=0; i<N-1;i++){
      String ha = str.get(i);
      if (ha.equals(str.get(i+1))){
        REN += 1;
        Ans += REN;
      }
      else{
        REN = 0;
      }
    }
    System.out.println(Ans);
  }
}