#include <bits/stdc++.h>
using namespace std;
long long int k = 0;
long long int siz = 0;
vector<pair<int, int> > ans;
int main() {
  ios_base::sync_with_stdio(), cin.tie(0), cout.tie(0);
  long long int n;
  cin >> n;
  vector<long long int> a(n);
  for (long long int i = 0; i < n; i = i + 1) cin >> a[i];
  map<long long int, vector<pair<int, int> >*> m;
  for (long long int i = 0; i < n; i = i + 1) {
    long long int sum = 0;
    for (long long int j = i; j < n; j = j + 1) {
      sum = sum + a[j];
      if (m.find(sum) == m.end()) {
        vector<pair<int, int> >* nodeptr = new vector<pair<int, int> >();
        nodeptr->push_back({i + 1, j + 1});
        m[sum] = nodeptr;
      } else {
        vector<pair<int, int> >* nodeptr = m[sum];
        nodeptr->push_back({i + 1, j + 1});
      }
    }
  }
  for (map<long long int, vector<pair<int, int> >*>::iterator it = m.begin();
       it != m.end(); ++it) {
    vector<pair<int, int> >* nodeptr = it->second;
    vector<pair<int, int> > arr = *nodeptr;
    for (long long int i = 0; i < arr.size(); i++)
      swap(arr[i].first, arr[i].second);
    sort(arr.begin(), arr.end());
    for (long long int i = 0; i < arr.size(); i++)
      swap(arr[i].first, arr[i].second);
    vector<pair<int, int> > temp;
    temp.push_back(arr[0]);
    for (long long int i = 1; i < arr.size(); i++)
      if (arr[i].first > temp.back().second) temp.push_back(arr[i]);
    if (temp.size() > siz) {
      siz = temp.size();
      k = it->first;
      ans.clear();
      for (long long int i = 0; i < temp.size(); i = i + 1)
        ans.push_back(temp[i]);
    }
  }
  cout << siz << "\n";
  for (long long int i = 0; i < siz; i = i + 1)
    cout << ans[i].first << " " << ans[i].second << "\n";
  return 0;
}
