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

int main()
{
  int N;
  cin >> N;
  map<string, int> mp;
  long long int ans = 0;
  for (int i = 0; i < N; i++)
  {
    string S;
    cin >> S;
    sort(S.begin(), S.end());
    mp[S]++;
    if (mp[S] > 1)
      ans += mp[S] - 1;
  }
  cout << ans << endl;
}
