#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long T = 1;
  for (long long testcase = 1; testcase <= T; ++testcase) {
    long long size;
    std::cin >> size;
    long long arr[size];
    for (long long i = 0; i < size; ++i) {
      std::cin >> arr[i];
    }
    long long count = 0;
    for (long long i = 1; i < size - 1; ++i) {
      if (arr[i] == 0 and arr[i - 1] == 1 and arr[i + 1] == 1) {
        ++count;
        arr[i + 1] = 0;
      }
    }
    std::cout << count << '\n';
  }
  return 0;
}
