Two logicians place cards on their foreheads so that what is written on the card is visible only to the other logician. Consecutive positive integers

- have been written on the cards. The following conversation ensues
- A: "I don't know my number." B: "I don't know my number." A: "I don't know my number." B: "I don't know my number." ... n statements of ignorance later ... A or B: "I know my number."

What is on the card and how does the logician know it?