#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
inline void ADD(long long &a, long long b) { a = (a + b) % MOD; }
long long a[2000], pre[2000];
const int maxn = 4e6;
map<long long, int> mp;
struct node {
  int L;
  int cnt;
  node() {
    L = -1;
    cnt = 0;
  }
} p[maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    pre[i] = pre[i - 1] + a[i];
  }
  long long val;
  int maxx = 0;
  int tp = 0, idx;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < i; j++) {
      val = pre[i] - pre[j];
      if (mp.find(val) == mp.end())
        idx = mp[val] = tp++;
      else
        idx = mp[val];
      if (j + 1 > p[idx].L) {
        p[idx].L = i;
        p[idx].cnt++;
        if (p[idx].cnt > maxx) {
          maxx = p[idx].cnt;
          ans = idx;
        }
      }
    }
  }
  p[ans].L = -1;
  printf("%d\n", maxx);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < i; j++) {
      val = pre[i] - pre[j];
      if (mp[val] == ans && j + 1 > p[ans].L) {
        p[ans].L = i;
        printf("%d %d\n", j + 1, i);
        break;
      }
    }
  }
}
