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