"Off the top of my head" can mean "the first thing I can think of". It means the person didn't think very long about the answer. The answer was just the first thing that came to mind. In a related way, it can also mean what you know without access to a computer or reference book.
Person A: What restaurant is open after midnight?
Person B: Off the top of my head, the only place I can think of is McDonalds.
Person A: How many people live in China?
Person B: I'm not sure. Off the top of my head, I'd guess around 1.5 billion?.