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