2000 AIME Problem 15

A stack of 2000 cards is labeled with the integers from 1 to 2000 , with different integers on different cards. The cards in the stack are not in numerical order. The top card is removed from the stack and placed on the table, and the next card in the stack is moved to the bottom of the stack. The new top card is removed from the stack and placed on the table, to the right of the card already there, and the next card in the stack is moved to the bottom of the stack. This process - placing the top card to the right of the cards already on the table and moving the next card in the stack to the bottom of the stack - is repeated until all cards are on the table. It is found that, reading from left to right, the labels on the cards are now in ascending order: 1,2,3, \ldots, 1999,2000. In the original stack of cards, how many cards were above the card labeled 1999?