#include #include #include int count_possible_strings(int N, std::vector& strings) { std::unordered_set possible_strings; possible_strings.reserve(N * (N - 1)); for (int i = 0; i < N; ++i) { for (int j = i + 1; j < N; ++j) { possible_strings.insert(strings[i] + strings[j]); possible_strings.insert(strings[j] + strings[i]); } } return possible_strings.size(); } int main() { int N; std::cin >> N; std::vector strings(N); strings.reserve(N); for (int i = 0; i < N; ++i) { std::cin >> strings[i]; } std::cout << count_possible_strings(N, strings) << std::endl; return 0; }