#include<bits/stdc++.h>
using namespace std;
int main(){
  map<string,int> mp;
  long long result = 0;
  int n;cin>>n;
  for(int i=0;i<n;++i){
    string s;cin>>s;
    sort(s.begin(),s.end());
    result += mp[s];
    mp[s]++;
  }
  cout<<result<<endl;
  return 0;
}