#include using namespace std; int main(){ register short n,cnt=0; bool x; cin>>n>>x; while(--n){ if(x){ cin>>x; if(x){ cnt++; x=0; } } else cin>>x; } cout<