#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main() {
int N;
cin >> N;
vector<string> instructions(N);
for (int i = 0; i < N; i++) {
cin >> instructions[i];
}
int minMoves = 0;
string currentPosition = "down right"; // Initial position
for (int i = 0; i < N; i++) {
string nextPosition = instructions[i];
// Check if either leg needs to move
if (currentPosition[0] != nextPosition[0]) {
minMoves++;
}
if (currentPosition[1] != nextPosition[1]) {
minMoves++;
}
currentPosition = nextPosition;
}
cout << minMoves << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8c3RyaW5nPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkgewogICAgaW50IE47CiAgICBjaW4gPj4gTjsKCiAgICB2ZWN0b3I8c3RyaW5nPiBpbnN0cnVjdGlvbnMoTik7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IE47IGkrKykgewogICAgICAgIGNpbiA+PiBpbnN0cnVjdGlvbnNbaV07CiAgICB9CgogICAgaW50IG1pbk1vdmVzID0gMDsKICAgIHN0cmluZyBjdXJyZW50UG9zaXRpb24gPSAiZG93biByaWdodCI7IC8vIEluaXRpYWwgcG9zaXRpb24KCiAgICBmb3IgKGludCBpID0gMDsgaSA8IE47IGkrKykgewogICAgICAgIHN0cmluZyBuZXh0UG9zaXRpb24gPSBpbnN0cnVjdGlvbnNbaV07CgogICAgICAgIC8vIENoZWNrIGlmIGVpdGhlciBsZWcgbmVlZHMgdG8gbW92ZQogICAgICAgIGlmIChjdXJyZW50UG9zaXRpb25bMF0gIT0gbmV4dFBvc2l0aW9uWzBdKSB7CiAgICAgICAgICAgIG1pbk1vdmVzKys7CiAgICAgICAgfQogICAgICAgIGlmIChjdXJyZW50UG9zaXRpb25bMV0gIT0gbmV4dFBvc2l0aW9uWzFdKSB7CiAgICAgICAgICAgIG1pbk1vdmVzKys7CiAgICAgICAgfQoKICAgICAgICBjdXJyZW50UG9zaXRpb24gPSBuZXh0UG9zaXRpb247CiAgICB9CgogICAgY291dCA8PCBtaW5Nb3ZlcyA8PCBlbmRsOwoKICAgIHJldHVybiAwOwp9