문제 링크 : Height Checker
/**
* @param {number[]} heights
* @return {number}
*/
var heightChecker = function(heights) {
const sortedHeights = [...heights].sort((a,b) => a-b)
return sortedHeights.reduce((cnt,cur, idx) => cur !== heights[idx] ? cnt+1 : cnt, 0)
};