Function to return the count of rectangles when n is even
function countEven ( n ) { let coun = 0 , m , j , i ; for ( i = n - 2 ; i >= 1 ; i -- ) { if ( i >= 1 ) { m = parseInt ( ( ( n - 1 ) - i ) / 2 , 10 ) ; j = parseInt ( ( i * ( i + 1 ) ) / 2 , 10 ) ; coun += j * m ; } else { m = parseInt ( ( n - i ) / 2 , 10 ) ; j = parseInt ( ( i * ( i + 1 ) ) / 2 , 10 ) ; coun += j * m ; } } return coun ; }