Answer:
22 - count 'em yourself.
C, D, E, F, G, A, B, C', D', E', F', G', A', B', C'', D'', E'', F''', G'', A'', B'', C'''
Confused? Think the answer should be 24? It's not your fault - there are 7 different notes in an octave but musicians generally insist on counting C twice and saying there are 8 notes in an octave, mostly because they have been doing this for centuries and don't want to change, or don't really care.
It is like saying there are 8 days in a week - if today is Sunday and we meet again a week from now then the count is Sun, Mon, Tue, Wed, Thu, Fri, Sat, Sun = 8. I don't speak German, but apparently this is still found in their use of language (and maybe this was the inspiration for the Beatles' lyric "eight days a week"). This ancient form of counting has fallen out of favor over the centuries, and most of us would now agree that there are 7 days in a week. If we apply this modern technique to the octave (i.e., the major scale), then we count 7 notes. Therefore, there are 7x3 = 21 in 3 octaves. If you are counting the old way then append another C to the end and there is a grand total of 22.
To further confuse the matter, modern musicians talk about 12 chromatic notes in an octave, or 5 pentatonic notes in an octave. Musicians from India might give yet another answer.
To sort through the confusion, you really have to rephrase your question to avoid the words that confuse everyone. As a mathematician and guitar player, I prefer "How many frets in an octave jump? A:12" and "How many frets in a 2 octave jump? A:24". My guitar's neck is not long enough, but if it was then: "How many frets in a 3 octave jump? A:36".