Shortened countZero function