#include <bits/stdc++.h>
const long long MAX_N = 2 * 1e5;
long long dp[MAX_N + 1];
int main(int argc, char* argv[]) {
  long long N;
  std::cin >> N;
  std::vector<long long> va(N + 1, 0);
  for (long long i = 0; i < N; i++) {
    std::cin >> va[i];
  }
  dp[0] = 0;
  for (long long i = 1; i <= N; i++) {
    dp[i] = dp[i - 1] + va[i - 1];
  }
  long long ans = 0;
  for (long long i = 2; i <= N; i++) {
    for (long long j = 0; j < i; j++) {
      if (dp[i] == dp[j]) {
        std::cout << i << " " << j << " " << dp[i] << std::endl;
        ans++;
      }
    }
  }
  std::cout << ans << std::endl;
  return 0;
}
