#include <bits/stdc++.h>
using namespace std;

int64_t comb2(int n){
  return n*(n-1)/2;
}

int main(){
  
  int n; cin >> n;
  vector<vector<char>> character(n, vector<char>(10));
  for(int i=0; i<n; ++i){
    for(int j=0; j<10; ++j){
      cin >> character.at(i).at(j);
    }
    sort(character.at(i).begin(), character.at(i).end());
  }
  
  sort(character.begin(), character.end());
  vector<char> compared = character.at(0);
  int64_t sum = 0;
  
  for(int i=1; i<n; ++i){
    static int count = 1;
    
    if(compared != character.at(i)){
      sum += comb2(count);
      count = 1;
      compared = character.at(i);
    }
    else ++count;
    
    if(i == n-1){
      sum += comb2(count);
    }
  }
  
  cout << sum << endl;
  return 0;
}