Improvement of the eigenvalue-counting method based on the argument principle