#include <cstdio>
#include <set>
#include <vector>
using namespace std;
const int N = 2e5 + 20;
int a[N];
int main()
{
	int n,ans=0;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		scanf("%d", a + i);
	for (int i = 1; i <= n; i++)
		if (a[i - 1] == 1 && a[i] == 0 && a[i + 1] == 1)a[i + 1] = 0, ans++;
	printf("%d", ans);
	return 0;
}