import java.util.Scanner;
import java.util.Arrays;
import java.util.HashMap;

public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);
    
    while (in.hasNext()) {
      int N = in.nextInt();
      char[][] s = new char[N][10];
      
      for (int i = 0; i < s.length; ++i) {
        s[i] = in.next().toCharArray();
        
        Arrays.sort(s[i]);
      }
      
      HashMap<String, Integer> appearTimes = new HashMap<String, Integer>();
      long count = 0;
      for (int i = s.length - 1; i >= 0; --i) {
        String si = new String(s[i]);
        
        if (appearTimes.containsKey(si)) {
          int times = appearTimes.get(si);
          count += times;
          appearTimes.put(si, times + 1);
        } else {
          appearTimes.put(si, 1);
        }
      }
      
      System.out.println(count);
    }
  }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util import java.util.HashMap; HashMap java.util public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);
    
    while (in.hasNext()) {
      int N = in.nextInt();
      char[][] s = new char[N][10];
      
      for (int i = 0; i < s.length; ++i) {
        s[i] = in.next().toCharArray();
        
        Arrays.sort(s[i]);
      }
      
      HashMap<String, Integer> appearTimes = new HashMap<String, Integer>();
      long count = 0;
      for (int i = s.length - 1; i >= 0; --i) {
        String si = new String(s[i]);
        
        if (appearTimes.containsKey(si)) {
          int times = appearTimes.get(si);
          count += times;
          appearTimes.put(si, times + 1);
        } else {
          appearTimes.put(si, 1);
        }
      }
      
      System.out.println(count);
    }
  }
} Main public static void main (String[] args) {
    Scanner in = new Scanner(System.in);
    
    while (in.hasNext()) {
      int N = in.nextInt();
      char[][] s = new char[N][10];
      
      for (int i = 0; i < s.length; ++i) {
        s[i] = in.next().toCharArray();
        
        Arrays.sort(s[i]);
      }
      
      HashMap<String, Integer> appearTimes = new HashMap<String, Integer>();
      long count = 0;
      for (int i = s.length - 1; i >= 0; --i) {
        String si = new String(s[i]);
        
        if (appearTimes.containsKey(si)) {
          int times = appearTimes.get(si);
          count += times;
          appearTimes.put(si, times + 1);
        } else {
          appearTimes.put(si, 1);
        }
      }
      
      System.out.println(count);
    }
  } main {
    Scanner in = new Scanner(System.in);
    
    while (in.hasNext()) {
      int N = in.nextInt();
      char[][] s = new char[N][10];
      
      for (int i = 0; i < s.length; ++i) {
        s[i] = in.next().toCharArray();
        
        Arrays.sort(s[i]);
      }
      
      HashMap<String, Integer> appearTimes = new HashMap<String, Integer>();
      long count = 0;
      for (int i = s.length - 1; i >= 0; --i) {
        String si = new String(s[i]);
        
        if (appearTimes.containsKey(si)) {
          int times = appearTimes.get(si);
          count += times;
          appearTimes.put(si, times + 1);
        } else {
          appearTimes.put(si, 1);
        }
      }
      
      System.out.println(count);
    }
  } Scanner in = new Scanner(System.in); in new Scanner(System.in) while (in.hasNext()) {
      int N = in.nextInt();
      char[][] s = new char[N][10];
      
      for (int i = 0; i < s.length; ++i) {
        s[i] = in.next().toCharArray();
        
        Arrays.sort(s[i]);
      }
      
      HashMap<String, Integer> appearTimes = new HashMap<String, Integer>();
      long count = 0;
      for (int i = s.length - 1; i >= 0; --i) {
        String si = new String(s[i]);
        
        if (appearTimes.containsKey(si)) {
          int times = appearTimes.get(si);
          count += times;
          appearTimes.put(si, times + 1);
        } else {
          appearTimes.put(si, 1);
        }
      }
      
      System.out.println(count);
    } in.hasNext() in.hasNext in {
      int N = in.nextInt();
      char[][] s = new char[N][10];
      
      for (int i = 0; i < s.length; ++i) {
        s[i] = in.next().toCharArray();
        
        Arrays.sort(s[i]);
      }
      
      HashMap<String, Integer> appearTimes = new HashMap<String, Integer>();
      long count = 0;
      for (int i = s.length - 1; i >= 0; --i) {
        String si = new String(s[i]);
        
        if (appearTimes.containsKey(si)) {
          int times = appearTimes.get(si);
          count += times;
          appearTimes.put(si, times + 1);
        } else {
          appearTimes.put(si, 1);
        }
      }
      
      System.out.println(count);
    } int N = in.nextInt(); N in.nextInt() in.nextInt in char[][] s = new char[N][10]; s new char[N][10] N 10 for (int i = 0; i < s.length; ++i) {
        s[i] = in.next().toCharArray();
        
        Arrays.sort(s[i]);
      } int i = 0; int i = 0; i 0 i < s.length i s.length s s.length ++i ++i i {
        s[i] = in.next().toCharArray();
        
        Arrays.sort(s[i]);
      } {
        s[i] = in.next().toCharArray();
        
        Arrays.sort(s[i]);
      } s[i] = in.next().toCharArray() s[i] s i in.next().toCharArray() in.next().toCharArray in.next() in.next in Arrays.sort(s[i]) Arrays.sort Arrays s[i] s i HashMap<String, Integer> appearTimes = new HashMap<String, Integer>(); appearTimes new HashMap<String, Integer>() long count = 0; count 0 for (int i = s.length - 1; i >= 0; --i) {
        String si = new String(s[i]);
        
        if (appearTimes.containsKey(si)) {
          int times = appearTimes.get(si);
          count += times;
          appearTimes.put(si, times + 1);
        } else {
          appearTimes.put(si, 1);
        }
      } int i = s.length - 1; int i = s.length - 1; i s.length - 1 s.length s s.length 1 i >= 0 i 0 --i --i i {
        String si = new String(s[i]);
        
        if (appearTimes.containsKey(si)) {
          int times = appearTimes.get(si);
          count += times;
          appearTimes.put(si, times + 1);
        } else {
          appearTimes.put(si, 1);
        }
      } {
        String si = new String(s[i]);
        
        if (appearTimes.containsKey(si)) {
          int times = appearTimes.get(si);
          count += times;
          appearTimes.put(si, times + 1);
        } else {
          appearTimes.put(si, 1);
        }
      } String si = new String(s[i]); si new String(s[i]) if (appearTimes.containsKey(si)) {
          int times = appearTimes.get(si);
          count += times;
          appearTimes.put(si, times + 1);
        } else {
          appearTimes.put(si, 1);
        } appearTimes.containsKey(si) appearTimes.containsKey appearTimes si {
          int times = appearTimes.get(si);
          count += times;
          appearTimes.put(si, times + 1);
        } int times = appearTimes.get(si); times appearTimes.get(si) appearTimes.get appearTimes si count += times count times appearTimes.put(si, times + 1) appearTimes.put appearTimes si times + 1 times 1 {
          appearTimes.put(si, 1);
        } appearTimes.put(si, 1) appearTimes.put appearTimes si 1 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 in = new Scanner(System.in);
    
    while (in.hasNext()) {
      int N = in.nextInt();
      char[][] s = new char[N][10];
      
      for (int i = 0; i < s.length; ++i) {
        s[i] = in.next().toCharArray();
        
        Arrays.sort(s[i]);
      }
      
      HashMap<String, Integer> appearTimes = new HashMap<String, Integer>();
      long count = 0;
      for (int i = s.length - 1; i >= 0; --i) {
        String si = new String(s[i]);
        
        if (appearTimes.containsKey(si)) {
          int times = appearTimes.get(si);
          count += times;
          appearTimes.put(si, times + 1);
        } else {
          appearTimes.put(si, 1);
        }
      }
      
      System.out.println(count);
    }
  }
} public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);
    
    while (in.hasNext()) {
      int N = in.nextInt();
      char[][] s = new char[N][10];
      
      for (int i = 0; i < s.length; ++i) {
        s[i] = in.next().toCharArray();
        
        Arrays.sort(s[i]);
      }
      
      HashMap<String, Integer> appearTimes = new HashMap<String, Integer>();
      long count = 0;
      for (int i = s.length - 1; i >= 0; --i) {
        String si = new String(s[i]);
        
        if (appearTimes.containsKey(si)) {
          int times = appearTimes.get(si);
          count += times;
          appearTimes.put(si, times + 1);
        } else {
          appearTimes.put(si, 1);
        }
      }
      
      System.out.println(count);
    }
  }
} Main
import java.util.Scanner;
import java.util.Arrays;
import java.util.HashMap;

public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);
    
    while (in.hasNext()) {
      int N = in.nextInt();
      char[][] s = new char[N][10];
      
      for (int i = 0; i < s.length; ++i) {
        s[i] = in.next().toCharArray();
        
        Arrays.sort(s[i]);
      }
      
      HashMap<String, Integer> appearTimes = new HashMap<String, Integer>();
      long count = 0;
      for (int i = s.length - 1; i >= 0; --i) {
        String si = new String(s[i]);
        
        if (appearTimes.containsKey(si)) {
          int times = appearTimes.get(si);
          count += times;
          appearTimes.put(si, times + 1);
        } else {
          appearTimes.put(si, 1);
        }
      }
      
      System.out.println(count);
    }
  }
}