At the first corner it is 2. The next is at 3. Let's put it in a function table. (I drew this table a little type-roughly, pardon me)

f(x) g(x)
1    2
2    3

Let's find the function. It is concluded that it is in this equation:
g(x)=f(x)+1 \\ or \\ f(x)=g(x)-1

So to find 22, just follow the function.
f(x)=g(x)-1 \\ f(22)=g(x)+1 \\ f(22)=g(23)

Therefore the answer is 23.