#include #include using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int N, i, j; string S[50]; set Ts; cin >> N; for (i = 0; i != N; ++i) cin >> S[i]; for (i = 0; i != N; ++i) for (j = i + 1; j != N; ++j) Ts.insert(S[i] + S[j]), Ts.insert(S[j] + S[i]); cout << Ts.size() << '\n'; return 0; }