#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;
bool comparator(pair<int, int> a, pair<int, int> b) {
  if (a.second == b.second) return a.first < b.first;
  return a.second < b.second;
}
void solve() {
  int n, s = 0, mx = 0;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i += 1) cin >> a[i];
  ;
  map<int, vector<pair<int, int>>> mp;
  vector<pair<int, int>> ans;
  for (int i = 0; i < n; i += 1) {
    s = 0;
    for (int j = i; j < n; j += 1) {
      s += a[j];
      mp[s].push_back({i + 1, j + 1});
    }
  }
  for (auto it : mp) {
    sort(mp[it.first].begin(), mp[it.first].end(), comparator);
    vector<pair<int, int>> temp;
    int r = 0;
    for (auto v : mp[it.first]) {
      if (v.first > r) {
        temp.push_back({v.first, v.second});
        r = v.second;
      }
    }
    if ((int)temp.size() > mx) {
      mx = (int)temp.size();
      ans = temp;
    }
  }
  cout << mx << "\n";
  for (auto p : ans) cout << p.first << ' ' << p.second << "\n";
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
