#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M, i;
  cin >> N;
  int a[N];
  for (i = 1; i <= N; i++) {
    cin >> a[i];
  }
  int l, r, sum, count = 0;
  for (l = 1; l <= N; l++) {
    for (r = 1; r <= N; r++) {
      sum = 0;
      for (i = l; i <= r; i++) {
        sum += a[i];
      }
      cout << sum << endl;
      if (sum % M == 0) count++;
    }
  }
  cout << count << endl;
  return 0;
}
