There are 100 people in a queue waiting to enter a hall. The hall has exactly 100 seats numbered from 1 to 100. The first person in the queue... There are $100$ people in a queue waiting to enter a hall. The hall has exactly $100$ seats numbered from $1$ to $100$. The first person in the queue enters the hall, chooses any seat and sits there. The $n$-th person in the queue where $n$ can be $2,\ldots,100$, enters the hall after $(n-1)$-th person is seated. He sists in seat number $n$ if he finds it vacant; otherwise he takes any unoccupied seat. Find the total number of ways in which $100$ seats can be filled up, provided the $100$-th person occupies seat number $100$.  

I could not realise how this chaotic behaviour will end. I think the solution lies in finding that. Please help.
Let $s_r$ be the number of the seat taken by the $r^{th}$ person.

Suppose $s_1=k_1$, then person $k_1$ is the first to find their seat already filled. Either person $k_1$ takes seat $1$, when the remainder of the passengers take their own seat, or $s_{k_1}=k_2\gt k_1$. Person $k_2$ is the second person to find their seat occupied (repeat the argument).

So you need to count the number of increasing sequences $2\leq k_1\lt \dots \lt k_r\le 99$ where $k_r$ indexes the people who find their seat occupied and have to occupy a seat other than their own.


   To compute the count note that any number between $2$ and $99$ inclusive can either be in the sequence or out of it. So that comes to $2^{98}$.


The normal question about this situation is to find the probability that the $100^{th}$ person sits in their own seat. If this is part of your method for solving that, it is not the easiest way of getting an answer.
The correct answer is 99!
Check it out for 4 people. 
This is an application of funtions. i.e No.  of one-one functions when co-domain(No. of seats)  and domain(passengers)  are equal.