#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k = 0;     cin >> n;     int arr[n + 2];     arr[0] = arr[n + 1] = 0;     for (int i = 1; i <= n; i++) cin >> arr[i];     for (int i = 1; i <= n; i++)       if (arr[i - 1] == 1 && arr[i + 1] == 1 && arr[i] == 0) arr[i + 1] = 0, k++;     cout << k;     return 0;   }   