A characterization on n-cotilting and n-tilting modules