#include #include class Solution { public: static int heightChecker(const std::vector& h) { auto x = h; std::stable_sort(x.begin(), x.end()); int ret = 0; for (int i = 0; i < x.size(); ++i) ret += (x[i] != h[i]); return ret; } };