#include <bits/stdc++.h>
using namespace std;
bool comp(pair<int, int> a, pair<int, int> b) { return (a.second < b.second); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> v(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> v[i + 1];
  }
  unordered_map<int, vector<pair<int, int>>> mp;
  for (int i = 1; i <= n; i++) {
    int sum = 0;
    bool flag = false;
    for (int j = 1; j <= n; j++) {
      sum += v[j];
      if (flag or j % i == 0) {
        mp[sum].push_back({j - i + 1, j});
        sum -= v[j - i + 1];
        flag = true;
      }
    }
  }
  int ans = 0;
  unordered_map<int, vector<pair<int, int>>>::iterator iter;
  for (auto it = mp.begin(); it != mp.end(); it++) {
    vector<pair<int, int>> gg = it->second;
    sort(gg.begin(), gg.end(), comp);
    sort(it->second.begin(), it->second.end(), comp);
    int tmp = 0;
    int en = 0;
    for (int i = 0; i < it->second.size(); i++) {
      if (it->second[i].first > en) {
        tmp++;
        en = it->second[i].second;
      }
    }
    if (tmp > ans) {
      ans = tmp;
      iter = it;
    }
  }
  cout << ans << endl;
  int en = 0;
  for (int i = 0; i < iter->second.size(); i++) {
    if (iter->second[i].first > en) {
      cout << iter->second[i].first << " " << iter->second[i].second << endl;
      en = iter->second[i].second;
    }
  }
  return 0;
}
