import java.io.*;
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    Map<String, Integer> map = new HashMap<>();
    
    char[] chars = new char[10];
    StringBuilder sb;
    long sum = 0;
    for (int i = 0; i < N; i++) {
      sc.next().getChars(0, 10, chars, 0);
      Arrays.sort(chars);
      sb = new StringBuilder();
      for (int j = 0; j < 10; j++) {
        sb.append(chars[j]);
      }
      
      String key = sb.toString();
      Integer val = map.get(key);
      if (val == null) {
        val = 1;
      } else {
        val++;
      }
      map.put(key, val);
      sum += val - 1;
    }
    
    System.out.println(sum);
  }
} import java.io.*; io.* java import java.util.*; util.* java class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    Map<String, Integer> map = new HashMap<>();
    
    char[] chars = new char[10];
    StringBuilder sb;
    long sum = 0;
    for (int i = 0; i < N; i++) {
      sc.next().getChars(0, 10, chars, 0);
      Arrays.sort(chars);
      sb = new StringBuilder();
      for (int j = 0; j < 10; j++) {
        sb.append(chars[j]);
      }
      
      String key = sb.toString();
      Integer val = map.get(key);
      if (val == null) {
        val = 1;
      } else {
        val++;
      }
      map.put(key, val);
      sum += val - 1;
    }
    
    System.out.println(sum);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    Map<String, Integer> map = new HashMap<>();
    
    char[] chars = new char[10];
    StringBuilder sb;
    long sum = 0;
    for (int i = 0; i < N; i++) {
      sc.next().getChars(0, 10, chars, 0);
      Arrays.sort(chars);
      sb = new StringBuilder();
      for (int j = 0; j < 10; j++) {
        sb.append(chars[j]);
      }
      
      String key = sb.toString();
      Integer val = map.get(key);
      if (val == null) {
        val = 1;
      } else {
        val++;
      }
      map.put(key, val);
      sum += val - 1;
    }
    
    System.out.println(sum);
  } main {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    Map<String, Integer> map = new HashMap<>();
    
    char[] chars = new char[10];
    StringBuilder sb;
    long sum = 0;
    for (int i = 0; i < N; i++) {
      sc.next().getChars(0, 10, chars, 0);
      Arrays.sort(chars);
      sb = new StringBuilder();
      for (int j = 0; j < 10; j++) {
        sb.append(chars[j]);
      }
      
      String key = sb.toString();
      Integer val = map.get(key);
      if (val == null) {
        val = 1;
      } else {
        val++;
      }
      map.put(key, val);
      sum += val - 1;
    }
    
    System.out.println(sum);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc Map<String, Integer> map = new HashMap<>(); map new HashMap<>() char[] chars = new char[10]; chars new char[10] 10 StringBuilder sb; sb long sum = 0; sum 0 for (int i = 0; i < N; i++) {
      sc.next().getChars(0, 10, chars, 0);
      Arrays.sort(chars);
      sb = new StringBuilder();
      for (int j = 0; j < 10; j++) {
        sb.append(chars[j]);
      }
      
      String key = sb.toString();
      Integer val = map.get(key);
      if (val == null) {
        val = 1;
      } else {
        val++;
      }
      map.put(key, val);
      sum += val - 1;
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      sc.next().getChars(0, 10, chars, 0);
      Arrays.sort(chars);
      sb = new StringBuilder();
      for (int j = 0; j < 10; j++) {
        sb.append(chars[j]);
      }
      
      String key = sb.toString();
      Integer val = map.get(key);
      if (val == null) {
        val = 1;
      } else {
        val++;
      }
      map.put(key, val);
      sum += val - 1;
    } {
      sc.next().getChars(0, 10, chars, 0);
      Arrays.sort(chars);
      sb = new StringBuilder();
      for (int j = 0; j < 10; j++) {
        sb.append(chars[j]);
      }
      
      String key = sb.toString();
      Integer val = map.get(key);
      if (val == null) {
        val = 1;
      } else {
        val++;
      }
      map.put(key, val);
      sum += val - 1;
    } sc.next().getChars(0, 10, chars, 0) sc.next().getChars sc.next() sc.next sc 0 10 chars 0 Arrays.sort(chars) Arrays.sort Arrays chars sb = new StringBuilder() sb new StringBuilder() for (int j = 0; j < 10; j++) {
        sb.append(chars[j]);
      } int j = 0; int j = 0; j 0 j < 10 j 10 j++ j++ j {
        sb.append(chars[j]);
      } {
        sb.append(chars[j]);
      } sb.append(chars[j]) sb.append sb chars[j] chars j String key = sb.toString(); key sb.toString() sb.toString sb Integer val = map.get(key); val map.get(key) map.get map key if (val == null) {
        val = 1;
      } else {
        val++;
      } val == null val null {
        val = 1;
      } val = 1 val 1 {
        val++;
      } val++ val map.put(key, val) map.put map key val sum += val - 1 sum val - 1 val 1 System.out.println(sum) System.out.println System.out System System.out sum String[] args args
import java.io.*;
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    Map<String, Integer> map = new HashMap<>();
    
    char[] chars = new char[10];
    StringBuilder sb;
    long sum = 0;
    for (int i = 0; i < N; i++) {
      sc.next().getChars(0, 10, chars, 0);
      Arrays.sort(chars);
      sb = new StringBuilder();
      for (int j = 0; j < 10; j++) {
        sb.append(chars[j]);
      }
      
      String key = sb.toString();
      Integer val = map.get(key);
      if (val == null) {
        val = 1;
      } else {
        val++;
      }
      map.put(key, val);
      sum += val - 1;
    }
    
    System.out.println(sum);
  }
}