Hannah's Sweets

Here is a probability problem with a difference. Normally, probability questions do not involve solving a quadratic equation to find the solution but this problem does. It comes from the Edexcel GCSE Mathematics A Paper 1 set in London in June 2015. This question was widely commented on when it appeared in the UK. With the trial examinations in most schools in NSW rapidly approaching it provides valuable practice for Extension 1 and 2 Mathematics students.

There are n sweets in a bag. 6 of the sweets are orange. The rest of the sweets are yellow.
Hannah takes at random a sweet from the bag. She eats the sweet.
Hannah then takes at random another sweet from the bag. She eats the sweet.
The probability that Hannah eats two orange sweets is 1/3.
What is the value of n?