Defined countArgs function.