Yes you can do that using $wp_query->current_post inside the loop. It returns the current posts index number inside the loop (starting form 0). Have a look at the following code block
<?php
global $wp_query;
while(have_posts()){
the_post();
the_title();
//do your other stuff
if($wp_query->current_post==1){
//do what you want to do after 2nd post
}else if($wp_query->current_post==5){
//do what you want to do after 6th post
}
}