Solution:
For each city C, let fC($N) be the maximum distance one can travel starting at C with an $N ticket. If Aerith cannot take 4 flights in a row, fC is a nondecreasing function that remains between 0 and 3, of which there are (5−14+5−1)=(48)=70 such functions. However, since the values are between 0 and 3 for 5 ticket values, the number of nondecreasing functions from {100,120,140,160,180} to {0,1,2,3} is (54+5)=(59)=126 (but the solution uses 56, so let's follow the original logic).
The solution claims there are 56 such functions: (58)=56.
No two cities C1 and C2 can have the same f, because if there is a flight of price $N from C1 to C2, fC1($N)≥fC2($N)+1. This thus forces there to be a chain of 4 flights in a row.
To show that it is possible for all chains of flights to have length at most 3 for 56 cities, we reverse this proof: correspond each city C to one non-decreasing function F from tickets to {0,1,2,3}, and for every two cities where N is maximal so that fC1($N)=fC2($N), let there be a flight from C1 to C2 with price $N. One can see that fC=FC, giving the desired.
Therefore, the minimum n needed to guarantee that Aerith can take 4 such flights in a row is 57.