#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans = 0;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    int sum = 0;
    for (int j = i; j < n; j++) {
      cin >> a[j];
      sum += a[j];
      if (sum == 0) ans++;
    }
  }
  cout << ans << endl;
}
