A bowl contains N spaghetti noodles. You reach into the bowl and grab two free ends at random and attach them. You do this N times until there are no free ends left.
On average, how many loops are formed by this process? Show your working. [24 marks]