
#include <bits/stdc++.h>
#define pp pair<int,int>
using namespace std;
const int N = 2e5+5 , M = 1e9+5, OO = 0x3f3f3f3f;
typedef long long ll;
ll n;
map<string, int> ma;
ll ans;
string s;

ll calc(ll x)
{
    return (x * (x-1)/2) ;
}

int main()
{
    cin >> n;
    for(int i=0; i<n; ++i)
    {
        cin >> s;
        sort(s.begin(), s.end());
        ma[s]++;
    }
    for(auto sf : ma)
    {
        //cout << sf.first << " " << sf.second << endl;
        if(sf.second > 1)
        {
            //cout << calc(sf.second) << endl;
            ans += calc(sf.second);
        }
    }
    cout << ans << endl;
    return 0;
}

