The solution of this problem depends on the concept of theCatalan numbers. Here is the idea. Suppose n=10 then think of the queue as fffffttttt. That is f is for the five rupee coin and t is for the ten rupee note. If the queue happens to be ftffttfftt there will be no stoppage. However ftffttfttf will stop at the ninth person, why? Well for no stoppage we need each t to be preceded by more f’s than t’s.

You should lookup Catalan numbers.