temp > n is checked so that pairs ( x , y ) and ( y , x ) don 't get counted twice
if ( temp > n ) { for ( let j = 0 ; j < nums . length ; j ++ ) { if ( nums [ j ] == temp ) count += 1 ; } } } return count ; }