#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int n;
cin >> n;
int prev = 0;
int ans = 0;
while(n--)
{
int a;
cin >> a;
ans += prev && ((a ^ prev) & 1);
prev = a;
}
cout << ans << "\n";
return 0;
}