#include <bits/stdc++.h>

using namespace std;

#define ll long long

int main(){

	int n, x;
	cin >> n;
	x = n;
        map<string, int> mp;
        cin.ignore();

	ll cnt = 0;
	while(n--){
		string s;
		getline(cin, s);
		sort(s.begin(), s.end());
		cnt += mp[s];
		mp[s]++;
	}

	cout << cnt;

	return 0;
}
