#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long> a(N);
  for (int i = 0; i < N; ++i) cin >> a[i];
  vector<long long> s(N + 1, 0);
  for (int i = 0; i < N; ++i) s[i + 1] = s[i] + a[i];
  long long g, sum = 0;
  for (int i = 1; i < N + 1; i++) {
    for (int j = i; j < N + 1; j++) {
      cout << s[j] << " " << s[i - 1] << " " << s[j] - s[i - 1] << endl;
      if (s[j] - s[i - 1] == 0) {
        g += 1;
      }
    }
  }
  cout << g << endl;
  return 0;
}
