| 3 | using namespace::std; |
| 4 | |
| 5 | signed main(){ |
| 6 | ios_base::sync_with_stdio(false),cin.tie(nullptr); |
| 7 | |
| 8 | int n; cin >> n; |
| 9 | std::vector<int> v(n); |
| 10 | map<int,int>m; |
| 11 | int ans = 1; |
| 12 | for (int &x: v) cin >> x, --x; |
| 13 | for (int i = 0; i < n; ++i) { m[v[i]] = i; } |
| 14 | for (int i = 1; i < n; ++i) { |
| 15 | ans += (m[i] < m[i-1]); |
| 16 | } |
| 17 | cout << ans << endl; |
| 18 | return 0; |
| 19 | } |
| 20 | |
| 21 | // main observation is |
| 22 | // if a number x come before x + 1 then no extra move required but otherwise we need extra move |
nothing calls this directly
no outgoing calls
no test coverage detected