#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 = "up 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;
}
CiNpbmNsdWRlIDxpb3N0cmVhbT4KI2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPHN0cmluZz4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKICAgIGludCBOOwogICAgY2luID4+IE47CgogICAgdmVjdG9yPHN0cmluZz4gaW5zdHJ1Y3Rpb25zKE4pOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBOOyBpKyspIHsKICAgICAgICBjaW4gPj4gaW5zdHJ1Y3Rpb25zW2ldOwogICAgfQoKICAgIGludCBtaW5Nb3ZlcyA9IDA7CiAgICBzdHJpbmcgY3VycmVudFBvc2l0aW9uID0gInVwIHJpZ2h0IjsgLy8gSW5pdGlhbCBwb3NpdGlvbgoKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgTjsgaSsrKSB7CiAgICAgICAgc3RyaW5nIG5leHRQb3NpdGlvbiA9IGluc3RydWN0aW9uc1tpXTsKCiAgICAgICAgLy8gQ2hlY2sgaWYgZWl0aGVyIGxlZyBuZWVkcyB0byBtb3ZlCiAgICAgICAgaWYgKGN1cnJlbnRQb3NpdGlvblswXSAhPSBuZXh0UG9zaXRpb25bMF0pIHsKICAgICAgICAgICAgbWluTW92ZXMrKzsKICAgICAgICB9CiAgICAgICAgaWYgKGN1cnJlbnRQb3NpdGlvblsxXSAhPSBuZXh0UG9zaXRpb25bMV0pIHsKICAgICAgICAgICAgbWluTW92ZXMrKzsKICAgICAgICB9CgogICAgICAgIGN1cnJlbnRQb3NpdGlvbiA9IG5leHRQb3NpdGlvbjsKICAgIH0KCiAgICBjb3V0IDw8IG1pbk1vdmVzIDw8IGVuZGw7CgogICAgcmV0dXJuIDA7Cn0=