AT_awc0003_b 握手の列

Description

Takahashi is observing an interesting phenomenon at a party venue. $ N $ participants are standing in a line, all facing the same direction (to the right), and are numbered $ 1, 2, \ldots, N $ from left to right. Each participant is wearing a glove on their left hand and right hand (from their own perspective). The color of each glove is either navy or white. In the input, navy is represented by `N` (Navy) and white is represented by `S` (Snow). > **Note:** The character `N` representing the navy color and the integer $ N $ representing the number of participants are different things. Please be careful not to confuse them. The color of participant $ i $ 's left-hand glove is given as $ L_i $ , and the color of their right-hand glove is given as $ R_i $ . Since all participants are standing in a line facing the same direction, when two adjacent participants shake hands, the right hand of the left participant (the one with the smaller number) and the left hand of the right participant (the one with the larger number) touch each other. If the colors of the two gloves that touch are the same (both navy or both white), this is called an **awkward handshake**. Takahashi wants to know the number of adjacent participant pairs that result in an awkward handshake. Specifically, for each $ i = 1, 2, \ldots, N-1 $ , check whether the color of participant $ i $ 's right-hand glove $ R_i $ and the color of participant $ i+1 $ 's left-hand glove $ L_{i+1} $ are the same, and find the number of such $ i $ .

Input Format

> $ N $ $ L_1 $ $ R_1 $ $ L_2 $ $ R_2 $ $ \vdots $ $ L_N $ $ R_N $ - The first line contains an integer $ N $ representing the number of participants. - In the following $ N $ lines, the $ i $ -th line $ (1 \leq i \leq N) $ contains the character $ L_i $ representing the color of participant $ i $ 's left-hand glove and the character $ R_i $ representing the color of participant $ i $ 's right-hand glove, separated by a space. Each of $ L_i $ and $ R_i $ is either `N` (navy) or `S` (white).

Output Format

Print the number of adjacent participant pairs that result in an awkward handshake, in a single line.

Explanation/Hint

### Constraints - $ 2 \leq N \leq 2 \times 10^5 $ - $ L_i $ is `N` or `S` $ (1 \leq i \leq N) $ - $ R_i $ is `N` or `S` $ (1 \leq i \leq N) $