javascript solution
\nvar countGoodRectangles = function(rectangles) {\n    let [min, max, count] = [0, 0, 0];\n    \n    for(let i = 0; i < rectangles.length; i++) {\n        let 
```\nvar countGoodRectangles = function(rectangles) {\n    let [min, max, count] = [0, 0, 0];\n    \n    for(let i = 0; i < rectangles.length; i++) {\n        let rec = rectangles[i];\n        min = foundMin(rec[0], rec[1]);        \n        if( min == max ) {\n            count++;\n        }\n        if( min > max ) {\n            max = min;\n            count = 1;\n        }\n    }\n    return count;\n};\n\nfunction foundMin(a, b) {\n    if( a < b ) return a;\n    else return b;\n}\n```
['JavaScript']