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

int main()
{
	map<string,ll>m;
	string s;
	ll n,ans=0;
	cin>>n;
	while(n--)
	{
		cin>>s;
		sort(s.begin(),s.end());
		m[s]++;
	}
	for(auto it=m.begin();it!=m.end();it++)
		ans+=it->second*(it->second-1)/2;
	cout<<ans<<endl;
}