#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v[2250009];
map<int, int> mp;
vector<pair<int, int> > ans;
int a[1500 + 1];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (i != 0) a[i] += a[i - 1];
  }
  int id = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      int x = a[j] - a[i - 1];
      if (mp[x] == 0) {
        mp[x] = id;
        id++;
      }
      v[mp[x]].push_back(make_pair(j, i));
    }
  }
  int mx = 0, ix = 0;
  for (int i = 1; i < id; i++) {
    sort(v[i].begin(), v[i].end());
    int cnt = 1;
    int p = v[i][0].first;
    for (int j = 1; j < v[i].size(); j++) {
      if (v[i][j].second > p) {
        cnt++;
        p = v[i][j].first;
      }
    }
    if (cnt >= mx) {
      mx = cnt;
      ix = i;
    }
  }
  ans.push_back(v[ix][0]);
  int p = v[ix][0].first;
  for (int j = 1; j < v[ix].size(); j++) {
    if (v[ix][j].second > p) {
      ans.push_back(v[ix][j]);
      p = v[ix][j].first;
    }
  }
  cout << ans.size() << "\n";
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++)
    cout << ans[i].second << " " << ans[i].first << "\n";
}
