#include <bits/stdc++.h>
using namespace std;
int main() {
  long long TESTS = 1;
  while (TESTS--) {
    long long n;
    cin >> n;
    long long arr[n];
    map<long long, vector<pair<long long, long long> > > m;
    for (long long i = 0; i <= n - 1; i++) {
      cin >> arr[i];
    }
    for (long long i = 0; i <= n - 1; i++) {
      long long sum = 0;
      for (long long j = i; j >= 0; j--) {
        sum += arr[j];
        m[sum].push_back({j, i});
      }
    }
    vector<pair<long long, long long> > ans;
    long long maxi = 0;
    for (auto i : m) {
      long long l = 0, r = -1, counter = 0;
      vector<pair<long long, long long> > v = i.second;
      vector<pair<long long, long long> > temp;
      for (auto j : v) {
        if (j.first > r) {
          r = j.second;
          counter++;
          temp.push_back({j.first, j.second});
        }
        if (counter > maxi) {
          ans = temp;
          maxi = counter;
        }
      }
    }
    cout << maxi << endl;
    for (auto i : ans) {
      cout << i.first + 1 << " " << i.second + 1 << endl;
    }
  }
}
