Function to calculate the count of similar rectangles
function getCount ( rows , columns , A ) { var res = 0 ; for ( var i = 0 ; i < rows ; i ++ ) { for ( var j = i + 1 ; j < rows ; j ++ ) { if ( A [ i ] [ 0 ] * A [ j ] [ 1 ] == A [ i ] [ 1 ] * A [ j ] [ 0 ] ) { res ++ ; } } } return res ; }