#include <bits/stdc++.h>   using namespace std;   const int N = 1e4 + 5;   int n, a[N];   int main() {     ios ::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     if (fopen( main.in ,  r )) freopen( main.in ,  r , stdin);     cin >> n;     for (int i = 1; i <= n; i++) cin >> a[i];     int cnt = 0;     for (int i = 2; i < n; i++)       if (a[i - 1] == 1 && a[i + 1] == 1 && a[i] == 0) a[i + 1] = 0, cnt++;     cout << cnt;     return 0;   }   