#include <bits/stdc++.h>

using namespace std;
void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}
int main() {
    fast_io();
    int n;
    cin >> n;
    vector<string> s(n);
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    vector<string> ss;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            ss.push_back(s[i] + s[j]);
            ss.push_back(s[j] + s[i]);
        }
    }
    sort(ss.begin(), ss.end());
    ss.erase(unique(ss.begin(), ss.end()), ss.end());
    cout << ss.size() << endl;
}