A string of length is given. Each character of is either R or B.
You can perform the following operation:
- Choose an index : If the -th character of is
R, change it toB. If it isB, change it toR.
You want to perform given operations so that the set of positions where R appears is either empty or forms a single contiguous interval, and the set of positions where B appears is also either empty or forms a single contiguous interval.
Find the minimum number of operations required.
Input
The input is given in the following format.
Output
Print the minimum number of operations required.
Constraints
- .
- is a string of length consisting only of the characters
RandB.
Subtasks
Samples
예제 1
입력
5
RBRBR
출력
2
예제 2
입력
6
RRRBBB
출력
0