Credit for this problem goes to eberger. Thanks!

Higher or Lower

We are going to play a game. I’m going to be generating random numbers from a uniform distribution between 0 and 1. After each random number I generate, you must guess whether the next number will be higher or lower than the current number. The game continues as long as you keep guessing correctly. The first wrong guess, and the game is over.

If you play the game, I will pay you $1 for each correct guess. What is the most you would pay to play the game?