#include using namespace std; using namespace chrono; #if __has_include() #include using namespace atcoder; #endif int main() { const auto start = steady_clock::now(); random_device rnd; mt19937 engine(rnd()); int64_t n; string s; cin >> n >> s; set st; while (duration_cast(steady_clock::now() - start).count() < 1900) { if (st.size() == 10) { break; } // ranges::shuffle(s, engine); shuffle(s.begin(), s.end(), engine); st.insert(stoll(s.substr(n - 3, 3)) % 40); } cout << st.size() << endl; return 0; }