#include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
/*
* Complete the 'countStudents' function below.
*
* The function is expected to return an INTEGER.
* The function accepts INTEGER_ARRAY height as parameter.
*/
int countStudents(vector<int> height) {
int n = height.size();
vector<int> a;
for (auto x: height) a.push_back(x);
sort(a.begin(), a.end());
int ans = 0;
for (int i = 0; i < n; i++) {
if (height[i] != a[i]) ans++;
}
return ans;
}
int main()
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiAKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKIApzdHJpbmcgbHRyaW0oY29uc3Qgc3RyaW5nICYpOwpzdHJpbmcgcnRyaW0oY29uc3Qgc3RyaW5nICYpOwogCiAKLyoKICogQ29tcGxldGUgdGhlICdjb3VudFN0dWRlbnRzJyBmdW5jdGlvbiBiZWxvdy4KICoKICogVGhlIGZ1bmN0aW9uIGlzIGV4cGVjdGVkIHRvIHJldHVybiBhbiBJTlRFR0VSLgogKiBUaGUgZnVuY3Rpb24gYWNjZXB0cyBJTlRFR0VSX0FSUkFZIGhlaWdodCBhcyBwYXJhbWV0ZXIuCiAqLwogCmludCBjb3VudFN0dWRlbnRzKHZlY3RvcjxpbnQ+IGhlaWdodCkgewogICAgaW50IG4gPSBoZWlnaHQuc2l6ZSgpOwogICAgdmVjdG9yPGludD4gYTsKICAgIGZvciAoYXV0byB4OiBoZWlnaHQpIGEucHVzaF9iYWNrKHgpOwogICAgc29ydChhLmJlZ2luKCksIGEuZW5kKCkpOwogCmludCBhbnMgPSAwOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspIHsKICAgICAgICBpZiAoaGVpZ2h0W2ldICE9IGFbaV0pIGFucysrOwogICAgfQogICAgcmV0dXJuIGFuczsKfQppbnQgbWFpbigp