//Problem #A from Codeforces mindcoding
#include <cmath>

#include <algorithm>
#include <fstream>
#include <iostream>
#include <vector>
using namespace std;

#ifdef __APPLE__
#define DEBUG 1
#else
#define DEBUG 0
#endif

#define fi first
#define se second

const int inf = 0x3f3f3f3f;

int main() {
	int n;
	cin >> n;
	int last = 0, rez = 0;
	for (int i = 1; i <= n; ++i) {
		int b;
		cin >> b;
		if (last == 1 and b == 1) {
			b = 0;
			++rez;
		}
		last = b;
	}
	cout << rez << '\n';
    return 0;
}