#include<bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,m,n) for(int i=m; i<n; ++i) #define repl(i,m,n) for(ll i=m; i<n; ++i) int main(){ int N; cin >> N; vector<string> S(N); for(string &s : S) cin >> s; set<string> st; rep(i, 0, N) rep(j, 0, N){ if(i == j) continue; st.insert(S[i] + S[j]); } cout << st.size() << endl; return 0; }