Cowboy Dance, Jenne Magafan, 1941. At a Texas dance hall, $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) dancers are practicing the two-step. The dancers are numbered from $$$1$$$ to $$$n$$$, and each begins facing either left or right.
Dancer $$$i$$$ is a little particular: they only feel comfortable if at least $$$i$$$ remaining dancers, including themself, are facing the same direction.
The dance proceeds in beats. At the beginning of each beat, every remaining dancer counts how many dancers are facing the same direction as them.
If dancer $$$i$$$ sees fewer than $$$i$$$ dancers facing their direction, they get self-conscious. The first time this happens, they turn around, hoping to fit in better with the other side. If it happens again after they have already turned once, they give up and leave the dance floor.
All dancers make their decisions using the configuration at the beginning of the beat, and all actions happen simultaneously.
The dance ends when a beat passes in which nobody turns around or leaves.
Find the number of dancers remaining on the dance floor.
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$)—the number of dancers.
The second line contains a string $$$s$$$ of length $$$n$$$, consisting only of the characters L and R.
The $$$i$$$-th character of $$$s$$$ describes the initial direction of dancer $$$i$$$. If $$$s_i$$$ is L, dancer $$$i$$$ initially faces left; otherwise, dancer $$$i$$$ initially faces right.
Print a single integer—the number of dancers remaining when the dance ends.
5LLRLR
3
Initially, dancers $$$3$$$, $$$4$$$, and $$$5$$$ are uncomfortable, so they turn around.
On the next beat, dancers $$$4$$$ and $$$5$$$ are uncomfortable again and leave the dance floor.
The remaining dancers $$$1$$$, $$$2$$$, and $$$3$$$ are all comfortable, so the dance ends with $$$3$$$ dancers remaining.