The answer is n-2. Can you show why removing n-2 edges is sufficient to prevent G from containing a Hamiltonian cycle ?
Now we will prove why n-2 edges are necessary. The base case is easy to see. Assume that the claim holds true for upto n=m. For n = m+1, suppose removing m-2 edges is sufficient. Then choose such an edge which is removed and remove a vertex v that was incident to it, to form graph G'. Thus n decreases to m and the edges removed from G' are m-3. So, by our induction hypothesis, G' must contain a Hamiltonian cycle. If v has sufficient number of edges to G', then we can include it to expand the Hamiltonian cycle. If not, then in G, a large number of edges that we have removed must have been incident to v. Note that we can conclude the same for every vertex which had an incident edge removed. Can you complete the proof ?