#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> a(n);
  map<int, vector<pair<int, int>>> m, res;
  vector<pair<pair<int, int>, int>> v;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    int sum = 0;
    for (int j = i; j < n; j++) {
      sum += a[j];
      v.push_back({{j, i}, sum});
    }
  }
  sort(v.begin(), v.end());
  for (auto i : v) {
    m[i.second].push_back({i.first.second, i.first.first});
  }
  int k = 0;
  for (auto i : m) {
    int cur = -1;
    for (auto j : i.second) {
      if (j.first > cur) {
        cur = j.second;
        res[i.first].push_back({j.first + 1, j.second + 1});
        k = max(k, int(res[i.first].size()));
      }
    }
  }
  cout << k << '\n';
  for (auto i : res) {
    if (i.second.size() == k) {
      for (auto j : i.second) {
        cout << j.first << ' ' << j.second << '\n';
      }
      break;
    }
  }
  return 0;
}
