#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 15;
struct Node {
  int l, r;
  bool operator<(const Node& b) const { return r != b.r ? r < b.r : l < b.l; }
};
unordered_map<int, vector<Node> > mp;
int sum[N];
int main() {
  int n;
  while (~scanf("%d", &n)) {
    mp.clear();
    for (int i = 1; i <= n; i++) {
      scanf("%d", &sum[i]);
      sum[i] += sum[i - 1];
    }
    for (int i = 1; i <= n; i++) {
      for (int j = i; j <= n; j++) {
        mp[sum[j] - sum[i - 1]].emplace_back(Node{i, j});
      }
    }
    int ans = 0;
    vector<Node> vec, vecAns;
    for (auto ele : mp) {
      sort(ele.second.begin(), ele.second.end());
      vec.clear();
      int sum = 0, r = 0;
      for (auto seg : ele.second) {
        if (seg.l > r) {
          vec.emplace_back(Node{seg.l, seg.r});
          r = seg.r;
          sum++;
        }
      }
      if (ans < sum) {
        ans = sum;
        vecAns = vec;
      }
    }
    printf("%d\n", ans);
    for (auto ele : vecAns) {
      printf("%d %d\n", ele.l, ele.r);
    }
  }
}
