#include<bits/stdc++.h>
#include<iostream>
#include<set>
#define ll long long
using namespace std;
int main(){
   ll t;
   cin >>t;
   ll num=0;
   map<string , int> a;
   while(t--){
    string s;
    cin >>s;
    sort(s.begin(),s.end());
    num +=a[s]++;
   }
   cout<<num<<endl;
     return 0;
}