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

int main(){
  int N;
  cin >> N;

  map<string,long long> mp;

  for (int i = 0; i < N; i++)
  {
    string S;
    cin >> S;
    sort(S.begin(),S.end());
    mp[S]++;
  }
  long long ans = 0;
  for (auto MP:mp)
  {
    ans += MP.second * (MP.second - 1) / 2;
  }

  cout<< ans;


}