ok, what I finally did is forward-filling the empty cells inside ranges/merged cells, then I add in text 1 or 0 on every condition, and at last I check IF the right symbols are "1 1", giving 1 for True and 0 for False. Then summ them, which is equivalent to counting "ones".
'''=SUMM(IF(RIGHT(UNIQUE(LET(Arr;$A$3:$A$7;Seq;SEQUENCE(ROWS(Arr));LOOKUP(Seq;ЕСЛИ(LEN(Arr);Seq);Arr))&" "&IF(E$3:E$7;1;0)&" "&IF($C$3:$C$7=$C11;1;0));3)="1 1";1;0))