#include <iostream>
using namespace std;
int main() {
int n;
int result= 0;
int check = 1;
int arr[101]={0,};
int m;
scanf("%d",&n);
for(int i =0;i<n;i++){
scanf("%d",&m);
arr[i]=m;
//printf("%d", m);
}
for(int i=0;i<n;i++){
if ( arr[i] == 0){
check = 1;
}
else{
result +=check;
check +=1;
}
}
printf("%d",result);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: