#include<bits/stdc++.h>
using namespace std;
#define ll long long
string a;
map<string,int>q;
int main(){
	int n;
	scanf("%d",&n);
	ll ans=0;
	for(int i=1;i<=n;++i){
		cin>>a;
		sort(a.begin(),a.end());
		ans+=q[a];q[a]++;
	}
	printf("%lld",ans);
}