#include <bits/stdc++.h>
using namespace std;
int a[105];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  bool f = 0;
  bool g = 1;
  int num = 0;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (!f) {
      if (a[i] == 1) {
        f = 1;
        g = 1;
        num = 1;
      }
    } else {
      if (g) {
        if (a[i] == 0) {
          g = 0;
        } else {
          f = 1;
          ans += num / 2;
          num = 1;
        }
      } else {
        if (a[i] == 1) {
          num++;
          g = 1;
        } else {
          f = 0;
          ans += num / 2;
          num = 0;
        }
      }
    }
  }
  ans += num / 2;
  cout << ans << endl;
  return 0;
}
