#include <iostream>
using namespace std;

#include <iomanip>
void _130() {
    int w, h, x, y;
    cin >> w >> h >> x >> y;

    cout << fixed << setprecision(10);
    cout << (double)w * h / 2 << " " << (2 * x == w && 2 * y == h) << endl;
}

void _131() {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;

    long long count = 0;
    for (long long i = a; i <= b; ++i) {
        if (i % c != 0 && i % d != 0){
            count++;
        }
    }
    cout << count << endl;
}

#include <cmath>
void _131_() {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;

    long long min_baisuu;
    for (long long i = min(c, d); i <= c * d; ++i) {
        if (i % c == 0 && i % d == 0) {
            min_baisuu = i;
            cout << min_baisuu << endl;
            break;
        }
    }

    long long c_baisuu_num = 0;
    long long d_baisuu_num = 0;
    long long cd_baisuu_num = 0;

    c_baisuu_num = abs(a / c - b / c);
    d_baisuu_num = abs(a / d - b / d);
    cd_baisuu_num = abs(a / min_baisuu - b / min_baisuu);

    cout << abs(a - b) + 1 - (c_baisuu_num + d_baisuu_num - cd_baisuu_num) << endl;
}

void _131__() {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;

    long long min_baisuu = 0;
    long long max_yakusuu = 0;
    
    long long amari = 0;
    long long bigger = max(c, d);
    long long smaller = min(c, d);
    while (true) {
        amari = bigger % smaller;
        if (amari == 0) {
            max_yakusuu = smaller;
            break;
        }
        bigger = smaller;
        smaller = amari;
    }
    // cout << max_yakusuu << endl;
    min_baisuu = c * d / max_yakusuu;

    long long b_num = b - b / c  - b / d + b / min_baisuu;
    long long a_num = a - 1 - (a - 1) / c - (a - 1) / d + (a - 1) / min_baisuu;
    // cout << b_num << " " << a_num << endl;
    cout << b_num - a_num << endl;
}

#include <vector>
#include <algorithm>
void _132() {
    int n;
    cin >> n;
    vector<int> d;
    int tmp;
    for (int i = 0; i < n; ++i)  {
        cin >> tmp; 
        d.push_back(tmp);
    }
    sort(d.begin(), d.end());
    
    if (d.size() % 2 == 1) {
        cout << 0 <<endl;
        return;
    }
    int half_index = d.size() / 2 - 1;
    cout << d[half_index + 1] - d[half_index] << endl;

    

}

void _133() {
    int l, r;
    cin >> l >> r;

    if (r - l > 2019) {
        cout << 0 << endl;
        return;
    }
    int min_mod = 2019;
    long long multi;
    long long mod;
    for (int i = l; i <=r; ++i) {
        for (int j = i + 1; j  <= r; ++j) {
            multi = (long long)i * j;
            // multi = i * j;
            cout << multi << endl;
            mod = multi % 2019;
            // cout << i << " " << j << " " << mod <<endl;
            if (mod < min_mod) {
                min_mod = mod;
                // cout << min_mod << endl;
            }
        }
    }
    cout << min_mod << endl;
}

#include <vector>
#include <algorithm>
void _134() {
    int n;
    cin >> n;
    int tmp;
    vector<int> a;
    for (int i = 0; i < n; ++i) {
        cin >> tmp;
        a.push_back(tmp);
    }
    vector<int> b(a);
    sort(b.begin(), b.end());
    for (int i = 0; i < n; ++i) {
        if (a[i] == b[n - 1]) 
            cout << b[n - 2] << endl;
        else
            cout << b[n - 1] << endl;
    }


}

void _135() {
    int n;
    int a[100001];
    int b[100000];
    cin >> n;
    for (int i = 0; i < n + 1; ++i)
        cin >> a[i];
    for (int i = 0; i < n; ++i)
        cin >> b[i];

    int residual_capa = 0;
    long long count = 0;
    int nokori = 0;
    for (int i = 0; i < n; ++i) {
        nokori = max(0, a[i] - residual_capa);
        if (nokori == 0) {
            count += a[i];
            residual_capa = b[i];
        } else {
            nokori = max(0, nokori - b[i]);
            // cout << nokori << endl;
            if (nokori == 0) {
                count += a[i];
                residual_capa = b[i] - (a[i] - residual_capa);
            } else {
                count += residual_capa + b[i];
                residual_capa = 0;
            }
        }
        // cout << residual_capa << " " << count <<  endl;
    }

    count += min(residual_capa, a[n]);
    cout << count << endl;
}

void _136() {
    int n, h[100000];
    cin >> n;

    for (int i = 0; i < n; ++i)
        cin >> h[i];

    bool flag = false;
    int current = h[n - 1];
    for (int i = n - 1; i > 0; --i) {
        // cout << h[i - 1] << " " << current << endl;
        if (h[i - 1] <= current){
            current = h[i - 1];
        } else if (h[i - 1] - 1 == current){
            current = h[i - 1] - 1;
        } else {
            flag = true;
            break;
        }
    }

    if (flag == true)
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
}

#include <string>
#include <unordered_map>
#if 0
void count_char(string s, vector<map<char, int> > &data) {
    map<char, int> tmp;
    for (int i = 0; i < s.size(); ++i) {
        if (map.ke)

    }
}
#endif

void _137() {
#if 0
    // char test[] = "cab";
    // vector<char> a;
    string a("cab");
    // for (int i = 0; i < 3; ++i)
        // a.push_back(test[i]);
    sort(a.begin(), a.end());
    cout << a << endl;
#endif
#if 1
    int n;
    cin >> n;
    string s;
    unordered_map<string, long long> data;
    long long count = 0;
    long long anagram_count = 0;
    for (int i = 0; i < n; i++) {
        cin >> s;
        sort(s.begin(), s.end());
        count = data[s];
        if (count != 0) {
            anagram_count += count;
        }
        data[s] = count + 1;
    }

    cout << anagram_count << endl;
#endif

}

int main()
{
    _137();
    return 0;
}



Measured memory_bytes: 10660