#include <bits/stdc++.h>

using namespace std;

map<string, int> mp;
string s;
long long ans = 0;
int main()
{
	int n;
	cin >> n;
	while (n--)
	{
		cin >> s;
		sort(s.begin(), s.end());
		ans += mp[s]++;
	}
	cout << ans << endl;
}