#include <bits/stdc++.h>
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
const long double eps = 1e-9;
const long double Pi = acos(-1);
const long long md = (1e9 + 7);
using namespace std;
vector<pair<long long, long long> > v[2020];
map<long long, long long> m;
long long p[2020], a[2020], n, ans, ls[2020], dp[2020];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    p[i] = p[i - 1] + a[i];
  }
  for (long long i = 1; i <= n + 1; i++) {
    for (auto& j : v[i]) {
      m[j.first] = max(m[j.first], j.second);
    }
    v[i].clear();
    for (long long j = i; j <= n; j++) {
      long long cur = p[j] - p[i - 1];
      v[j + 1].push_back({cur, m[cur] + 1});
    }
  }
  long long it = 0;
  for (auto i : m) {
    if (ans < i.second) {
      ans = i.second;
      it = i.first;
    }
  }
  vector<long long> v[2020];
  cout << ans << "\n";
  for (long long i = 1; i <= n; i++) {
    for (long long j = i; j <= n; j++) {
      if (p[j] - p[i - 1] == it) {
        ls[j] = max(ls[j], i);
      }
    }
  }
  for (long long i = 1; i <= n; i++) {
    dp[i] = max(dp[i - 1], dp[i]);
    if (ls[i]) {
      dp[i] = max(dp[i], dp[ls[i] - 1] + 1);
    }
  }
  long long cur = ans;
  vector<pair<long long, long long> > vans;
  for (long long i = n; i >= 1; i--) {
    if (dp[i] == ans && ls[i] && dp[ls[i] - 1] == dp[i] - 1) {
      vans.push_back({ls[i], i});
      i = ls[i];
      ans--;
    }
  }
  for (auto& i : vans) {
    cout << i.first << " " << i.second << "\n";
  }
  return 0;
}
