// Arup Guha
// 6/19/2025
// Solution to Final Exam (2)
// https://open.kattis.com/problems/finalexam

using namespace std;
#include <bits/stdc++.h>

int main() {

    int n;
    cin >> n;

    vector<string> ans;

    // Read in choices.
    for (int i=0; i<n; i++) {
        string s;
        cin >> s;
        ans.push_back(s);
    }

    // Grade the student's answers by looking 1 answer back.
    int res = 0;
    for (int i=1; i<n; i++)
        if (ans[i] == ans[i-1])
            res++;

    // Ta da!
    cout << res << endl;

    return 0;
}
