Compute N(z) for DES catalogs using sparse format