#include <iostream>
using namespace std;
const int N = 1010;
int q[N];
int n,res;
int main(){
cin >> n;
for(int i = 0;i < n;i++){
cin >> q[i];
}
int j = 0;
for(int i = 0;i < n;i++){
while(q[i] == q[j] && j < n) j++;
if(j < n && q[i] != q[j]) res++,i = j - 1;
}
if(j >= n) res++;
cout << res << endl;
return 0;
}