How to apply dynamic block layout depending upon number of nodes in it (Drupal 8)?
Not everything is clear in your question, but there are some approaches for that task.
For example if you are using views module you can count number of views rows in twig template: 

{% if rows|length == 2 %}
   {% for row in rows %} 
//Here some staff for two rows
   {% endfor %} 
{% endif %}


About twig, about views templates

Also you can use jquery $('.some-class-for-every-row').length and add some style using js.