#include <bits/stdc++.h>
using namespace std;
const int N = 1510;
int a[N];
int sum[N];
int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> ans_order;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    sum[i] = sum[i - 1] + a[i];
  }
  map<int, vector<pair<int, int>>> mp;
  for (int j = 1; j <= n; ++j) {
    for (int i = 1; i <= j; ++i) {
      int val = sum[j] - sum[i - 1];
      mp[val].emplace_back(i, j);
    }
  }
  for (const auto &p : mp) {
    vector<pair<int, int>> t = p.second;
    vector<pair<int, int>> tt;
    int size = t.size();
    int l = 0;
    for (int i = 0; i < size; ++i) {
      if (t[i].first > l) {
        tt.push_back(t[i]);
        l = t[i].second;
      }
    }
    if (tt.size() > ans_order.size()) {
      ans_order = tt;
    }
  }
  cout << ans_order.size() << '\n';
  for (auto &i : ans_order) {
    cout << i.first << ' ' << i.second << '\n';
  }
  return 0;
}
