#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  map<string, int> 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& p : mp) {
    int t = p.second;
    ans += (long long)t * (t - 1) / 2;
  }
  cout << ans << endl;
  return 0;
}
