find posts with exactly 3/4 categories

Make sure you are providing correct category names into the function get_cat_ID().

<?php 
$catIDs = array();
$catIDs[] = get_cat_ID( 'CategoryName1' );
$catIDs[] = get_cat_ID( 'CategoryName2' );
$catIDs[] = get_cat_ID( 'CategoryName3' );

$my_query = new WP_Query( 
    array( 
        'category__and' => $catIDs 
    ) 
);
if( $my_query->have_posts() ) : 
    while( $my_query->have_posts() ) : $my_query->the_post(); ?>
        <li>
            <a href="https://wordpress.stackexchange.com/questions/125935/<?php the_permalink(); ?>"> <?php the_ID(); ?> </a>
        </li> <?php 
    endwhile; 
endif; 
wp_reset_postdata(); 
?>