#include <bits/stdc++.h>
using namespace std;

int main() 
{
    
    int n,pd,d,ph=0,ds,dj,du;
    
    cin>>n;
    
    for(int i=0; i<n; i++) {
      cin>>pd;
      if((abs(pd)-abs(ph))<=1) break;
      else if((abs(pd)-abs(ph))>1) du++;
    }
    
    cout<<du<<endl;
    
    return 0;
}