WordPress Custom Theme nth Post

I am just learning custom WordPress theme creation and I can’t find answers to some questions.

— I want to create a blog theme. There will be a carousel. How can I choose (for example) the first 4 posts for this carousel? And after them, the “latest posts” loop will start after 4th post.

I’ve found only the loop which is shown next;

<?php 
   if ( have_posts() ) : 
   while ( have_posts() ) : the_post(); 
    // Display post content
   endwhile; endif; 
?>