#include #include #include int main(void){ //値の取得 //------------------------------- int N{ 0 }; std::cin >> N; std::vector strs; for(int i{ 0 };i < N; ++i){ std::string str; std::cin >> str; strs.push_back(str); } //------------------------------- //アルゴリズム //------------------------------- std::vector catStrs; for(int i = 0; i < N; ++i){ for(int j = 0; j < N; ++j){ if(i != j){ if(catStrs.empty()){ catStrs.push_back(strs[i]+strs[j]); }else{ for(const std::string& cs: catStrs){ if( cs != (strs[i]+strs[j]) ){ catStrs.push_back(strs[i]+strs[j]); } } } } } } //------------------------------- std::cout << catStrs.size() << std::endl; }