import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    String[] s = new String[N]; 
    String[][] s_ = new String[N][10];

    for (int i = 0; i < N; i++) {
      s[i] = "";
      String str_ = sc.next();
      s_[i] = str_.split("");
      Arrays.sort(s_[i]);
      for (int j = 0; j < 10; j++) {
        s[i] += s_[i][j];
      }
    }

    Arrays.sort(s);

    sc.close(); 

    long count_ = 0;
    long count = 0;
    boolean countStart = false;

    for (int i = 0; i < N-1; i++){
      if (s[i].equals(s[i+1])) {
        if (countStart == false) {
          countStart = true;
          count_ = 1;
        }
        count_++;
      } else {
        if (countStart == true) {
          count += count_ * (count_ - 1) / 2;
          countStart = false;
        }
      }
    }

    if (countStart == true) {
      count += count_ * (count_ - 1) / 2;
    }

    System.out.println(count);
  
  }

} import java.util.*; util.* java public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    String[] s = new String[N]; 
    String[][] s_ = new String[N][10];

    for (int i = 0; i < N; i++) {
      s[i] = "";
      String str_ = sc.next();
      s_[i] = str_.split("");
      Arrays.sort(s_[i]);
      for (int j = 0; j < 10; j++) {
        s[i] += s_[i][j];
      }
    }

    Arrays.sort(s);

    sc.close(); 

    long count_ = 0;
    long count = 0;
    boolean countStart = false;

    for (int i = 0; i < N-1; i++){
      if (s[i].equals(s[i+1])) {
        if (countStart == false) {
          countStart = true;
          count_ = 1;
        }
        count_++;
      } else {
        if (countStart == true) {
          count += count_ * (count_ - 1) / 2;
          countStart = false;
        }
      }
    }

    if (countStart == true) {
      count += count_ * (count_ - 1) / 2;
    }

    System.out.println(count);
  
  }

} Main public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    String[] s = new String[N]; 
    String[][] s_ = new String[N][10];

    for (int i = 0; i < N; i++) {
      s[i] = "";
      String str_ = sc.next();
      s_[i] = str_.split("");
      Arrays.sort(s_[i]);
      for (int j = 0; j < 10; j++) {
        s[i] += s_[i][j];
      }
    }

    Arrays.sort(s);

    sc.close(); 

    long count_ = 0;
    long count = 0;
    boolean countStart = false;

    for (int i = 0; i < N-1; i++){
      if (s[i].equals(s[i+1])) {
        if (countStart == false) {
          countStart = true;
          count_ = 1;
        }
        count_++;
      } else {
        if (countStart == true) {
          count += count_ * (count_ - 1) / 2;
          countStart = false;
        }
      }
    }

    if (countStart == true) {
      count += count_ * (count_ - 1) / 2;
    }

    System.out.println(count);
  
  } main {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    String[] s = new String[N]; 
    String[][] s_ = new String[N][10];

    for (int i = 0; i < N; i++) {
      s[i] = "";
      String str_ = sc.next();
      s_[i] = str_.split("");
      Arrays.sort(s_[i]);
      for (int j = 0; j < 10; j++) {
        s[i] += s_[i][j];
      }
    }

    Arrays.sort(s);

    sc.close(); 

    long count_ = 0;
    long count = 0;
    boolean countStart = false;

    for (int i = 0; i < N-1; i++){
      if (s[i].equals(s[i+1])) {
        if (countStart == false) {
          countStart = true;
          count_ = 1;
        }
        count_++;
      } else {
        if (countStart == true) {
          count += count_ * (count_ - 1) / 2;
          countStart = false;
        }
      }
    }

    if (countStart == true) {
      count += count_ * (count_ - 1) / 2;
    }

    System.out.println(count);
  
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc String[] s = new String[N]; s new String[N] N String[][] s_ = new String[N][10]; s_ new String[N][10] N 10 for (int i = 0; i < N; i++) {
      s[i] = "";
      String str_ = sc.next();
      s_[i] = str_.split("");
      Arrays.sort(s_[i]);
      for (int j = 0; j < 10; j++) {
        s[i] += s_[i][j];
      }
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      s[i] = "";
      String str_ = sc.next();
      s_[i] = str_.split("");
      Arrays.sort(s_[i]);
      for (int j = 0; j < 10; j++) {
        s[i] += s_[i][j];
      }
    } {
      s[i] = "";
      String str_ = sc.next();
      s_[i] = str_.split("");
      Arrays.sort(s_[i]);
      for (int j = 0; j < 10; j++) {
        s[i] += s_[i][j];
      }
    } s[i] = "" s[i] s i "" String str_ = sc.next(); str_ sc.next() sc.next sc s_[i] = str_.split("") s_[i] s_ i str_.split("") str_.split str_ "" Arrays.sort(s_[i]) Arrays.sort Arrays s_[i] s_ i for (int j = 0; j < 10; j++) {
        s[i] += s_[i][j];
      } int j = 0; int j = 0; j 0 j < 10 j 10 j++ j++ j {
        s[i] += s_[i][j];
      } {
        s[i] += s_[i][j];
      } s[i] += s_[i][j] s[i] s i s_[i][j] s_[i] s_ i j Arrays.sort(s) Arrays.sort Arrays s sc.close() sc.close sc long count_ = 0; count_ 0 long count = 0; count 0 boolean countStart = false; countStart false for (int i = 0; i < N-1; i++){
      if (s[i].equals(s[i+1])) {
        if (countStart == false) {
          countStart = true;
          count_ = 1;
        }
        count_++;
      } else {
        if (countStart == true) {
          count += count_ * (count_ - 1) / 2;
          countStart = false;
        }
      }
    } int i = 0; int i = 0; i 0 i < N-1 i N-1 N 1 i++ i++ i {
      if (s[i].equals(s[i+1])) {
        if (countStart == false) {
          countStart = true;
          count_ = 1;
        }
        count_++;
      } else {
        if (countStart == true) {
          count += count_ * (count_ - 1) / 2;
          countStart = false;
        }
      }
    } {
      if (s[i].equals(s[i+1])) {
        if (countStart == false) {
          countStart = true;
          count_ = 1;
        }
        count_++;
      } else {
        if (countStart == true) {
          count += count_ * (count_ - 1) / 2;
          countStart = false;
        }
      }
    } if (s[i].equals(s[i+1])) {
        if (countStart == false) {
          countStart = true;
          count_ = 1;
        }
        count_++;
      } else {
        if (countStart == true) {
          count += count_ * (count_ - 1) / 2;
          countStart = false;
        }
      } s[i].equals(s[i+1]) s[i].equals s[i] s i s[i+1] s i+1 i 1 {
        if (countStart == false) {
          countStart = true;
          count_ = 1;
        }
        count_++;
      } if (countStart == false) {
          countStart = true;
          count_ = 1;
        } countStart == false countStart false {
          countStart = true;
          count_ = 1;
        } countStart = true countStart true count_ = 1 count_ 1 count_++ count_ {
        if (countStart == true) {
          count += count_ * (count_ - 1) / 2;
          countStart = false;
        }
      } if (countStart == true) {
          count += count_ * (count_ - 1) / 2;
          countStart = false;
        } countStart == true countStart true {
          count += count_ * (count_ - 1) / 2;
          countStart = false;
        } count += count_ * (count_ - 1) / 2 count count_ * (count_ - 1) / 2 count_ * (count_ - 1) count_ (count_ - 1) count_ 1 2 countStart = false countStart false if (countStart == true) {
      count += count_ * (count_ - 1) / 2;
    } countStart == true countStart true {
      count += count_ * (count_ - 1) / 2;
    } count += count_ * (count_ - 1) / 2 count count_ * (count_ - 1) / 2 count_ * (count_ - 1) count_ (count_ - 1) count_ 1 2 System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    String[] s = new String[N]; 
    String[][] s_ = new String[N][10];

    for (int i = 0; i < N; i++) {
      s[i] = "";
      String str_ = sc.next();
      s_[i] = str_.split("");
      Arrays.sort(s_[i]);
      for (int j = 0; j < 10; j++) {
        s[i] += s_[i][j];
      }
    }

    Arrays.sort(s);

    sc.close(); 

    long count_ = 0;
    long count = 0;
    boolean countStart = false;

    for (int i = 0; i < N-1; i++){
      if (s[i].equals(s[i+1])) {
        if (countStart == false) {
          countStart = true;
          count_ = 1;
        }
        count_++;
      } else {
        if (countStart == true) {
          count += count_ * (count_ - 1) / 2;
          countStart = false;
        }
      }
    }

    if (countStart == true) {
      count += count_ * (count_ - 1) / 2;
    }

    System.out.println(count);
  
  }

} public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    String[] s = new String[N]; 
    String[][] s_ = new String[N][10];

    for (int i = 0; i < N; i++) {
      s[i] = "";
      String str_ = sc.next();
      s_[i] = str_.split("");
      Arrays.sort(s_[i]);
      for (int j = 0; j < 10; j++) {
        s[i] += s_[i][j];
      }
    }

    Arrays.sort(s);

    sc.close(); 

    long count_ = 0;
    long count = 0;
    boolean countStart = false;

    for (int i = 0; i < N-1; i++){
      if (s[i].equals(s[i+1])) {
        if (countStart == false) {
          countStart = true;
          count_ = 1;
        }
        count_++;
      } else {
        if (countStart == true) {
          count += count_ * (count_ - 1) / 2;
          countStart = false;
        }
      }
    }

    if (countStart == true) {
      count += count_ * (count_ - 1) / 2;
    }

    System.out.println(count);
  
  }

} Main
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    String[] s = new String[N]; 
    String[][] s_ = new String[N][10];

    for (int i = 0; i < N; i++) {
      s[i] = "";
      String str_ = sc.next();
      s_[i] = str_.split("");
      Arrays.sort(s_[i]);
      for (int j = 0; j < 10; j++) {
        s[i] += s_[i][j];
      }
    }

    Arrays.sort(s);

    sc.close(); 

    long count_ = 0;
    long count = 0;
    boolean countStart = false;

    for (int i = 0; i < N-1; i++){
      if (s[i].equals(s[i+1])) {
        if (countStart == false) {
          countStart = true;
          count_ = 1;
        }
        count_++;
      } else {
        if (countStart == true) {
          count += count_ * (count_ - 1) / 2;
          countStart = false;
        }
      }
    }

    if (countStart == true) {
      count += count_ * (count_ - 1) / 2;
    }

    System.out.println(count);
  
  }

}