#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long n, a[1000];
  cin >> n;
  string s;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    ostringstream p;
    p << a[i];
    string pp;
    pp = p.str();
    s += pp;
  }
  long co = 0;
  for (long i = 1; i < n + 1; i++) {
    for (long j = 0; j < n - i + 1; j++) {
      int o = 0;
      o = stoi(s.substr(j, i));
      if (o == 0) {
        co += 1;
      }
    }
  }
  cout << co << endl;
}
