#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
int n, a[N], i, j, s[N], x, pos, ans, dem;
map<int, int> mpbool;
map<int, vector<pair<int, int>>> mp;
vector<pair<int, int>> res;
vector<int> allsum;
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    s[i] = s[i - 1] + a[i];
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= i; j++) {
      x = s[i] - s[j - 1];
      if (mpbool[x] == 0) {
        allsum.push_back(x);
        mpbool[x] = 1;
      }
      mp[x].push_back({j, i});
    }
  }
  for (auto& sum : allsum) {
    vector<pair<int, int>> now;
    pos = 0;
    dem = 0;
    for (auto& u : mp[sum]) {
      if (u.first > pos) {
        dem++;
        pos = u.second;
        now.push_back(u);
      }
    }
    if (dem > ans) {
      ans = dem;
      res = now;
    }
  }
  cout << ans << '\n';
  for (auto& u : res) cout << u.first << ' ' << u.second << '\n';
}
