If there would be such (polynomial) algorithm for a given $n$, there would be a polynomial algorithm for the original problem, since there is only a polynomial number of possible values for $n$, and you can try them all, since verification is polynomial.
PS. Write 'Complexity' instead of 'Hardness'.