SELECT COUNT(DISTINCT zp.spolis || zp.npolis) DN
FROM mtr.s19_schet s,
     mtr.s19_zap zp,
     mtr.s19_sl sl
WHERE s.year = $SY$ AND s.month <= $EM$ AND s.code = zp.code
      AND zp.idsp = 29 AND zp.id_zap = sl.id_zap AND 
      sl.p_cel = '1.3' AND SUBSTR(sl.ds1, 1, 3) BETWEEN 'I00' AND 'I99'
