#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 one or both legs need to move
if (currentPosition != nextPosition) {
minMoves++;
currentPosition = nextPosition;
}
}
cout << minMoves << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8c3RyaW5nPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkgewogICAgaW50IE47CiAgICBjaW4gPj4gTjsKCiAgICB2ZWN0b3I8c3RyaW5nPiBpbnN0cnVjdGlvbnMoTik7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IE47IGkrKykgewogICAgICAgIGNpbiA+PiBpbnN0cnVjdGlvbnNbaV07CiAgICB9CgogICAgaW50IG1pbk1vdmVzID0gMDsKICAgIHN0cmluZyBjdXJyZW50UG9zaXRpb24gPSAiZG93biByaWdodCI7IC8vIEluaXRpYWwgcG9zaXRpb24KCiAgICBmb3IgKGludCBpID0gMDsgaSA8IE47IGkrKykgewogICAgICAgIHN0cmluZyBuZXh0UG9zaXRpb24gPSBpbnN0cnVjdGlvbnNbaV07CgogICAgICAgIC8vIENoZWNrIGlmIG9uZSBvciBib3RoIGxlZ3MgbmVlZCB0byBtb3ZlCiAgICAgICAgaWYgKGN1cnJlbnRQb3NpdGlvbiAhPSBuZXh0UG9zaXRpb24pIHsKICAgICAgICAgICAgbWluTW92ZXMrKzsKICAgICAgICAgICAgY3VycmVudFBvc2l0aW9uID0gbmV4dFBvc2l0aW9uOwogICAgICAgIH0KICAgIH0KCiAgICBjb3V0IDw8IG1pbk1vdmVzIDw8IGVuZGw7CgogICAgcmV0dXJuIDA7Cn0K