temp > n is checked so that pairs ( x , y ) and ( y , x ) don 't get counted twice
if ( temp > n ) { for ( auto j = nums . begin ( ) ; j != nums . end ( ) ; j ++ ) { if ( ( * j ) == temp ) count += 1 ; } } } return count ; }