#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e3 + 5;
const long long mod = 998244353;
map<int, int> mp;
struct node {
  int l, r;
  bool operator<(const node &a) const {
    if (r != a.r) return r < a.r;
    return l < a.l;
  }
};
vector<node> g[maxn * maxn];
int a[maxn], ans[maxn][2], rans[maxn][2];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = (1); i <= (n); i++) scanf("%d", &a[i]), a[i] += a[i - 1];
  int cnt = 0;
  for (int i = (1); i <= (n); i++) {
    for (int j = (i); j <= (n); j++)
      if (!mp[a[j] - a[i - 1]]) mp[a[j] - a[i - 1]] = ++cnt;
  }
  for (int i = (1); i <= (n); i++) {
    for (int j = (i); j <= (n); j++)
      g[mp[a[j] - a[i - 1]]].push_back((node){i, j});
  }
  int Ans = 0;
  for (int i = (1); i <= (cnt); i++) {
    sort(g[i].begin(), g[i].end());
    int res = 1, R = g[i][0].r;
    rans[res][0] = g[i][0].l, rans[res][1] = g[i][0].r;
    for (int j = 1; j < g[i].size(); j++) {
      if (g[i][j].l > R) {
        rans[++res][0] = g[i][j].l, rans[res][1] = g[i][j].r;
        R = g[i][j].r;
      }
    }
    if (res > Ans) {
      Ans = res;
      for (int i = (1); i <= (res); i++)
        ans[i][0] = rans[i][0], ans[i][1] = rans[i][1];
    }
  }
  cout << Ans << endl;
  for (int i = (1); i <= (Ans); i++)
    printf("%d ", ans[i][0]), printf("%d ", ans[i][1]), puts("");
}
