#include <iostream>
using namespace std;
int main()
{
int n, x, y, z, sum;
int k[30];
cin>>n;
for(int i = 0; i < n; i++){
cin>>k[i];
}
sum = z = 0;
for(int i = 0; i < n; i++){
if(k[i] == 1 && z == 0){
x = i + 1;
z += 1;
}
else if(k[i] == 1){
y = i - 1;
for(int j = x; j <= y; j++){
if(k[j] == 0){
sum += 1;
}
else if(k[j] == 9){
if(k[j - 1] == 0 && (j - 1) >= x){
sum -= 1;
}
if(k[j + 1] == 0 && (j + 1) <= y){
sum -= 1;
}
}
}
x = i + 1;
}
}
cout<<sum<<endl;
return 0;
}
一直出現92趴....