#include <bits/stdc++.h>
using namespace std;
int a[2000];
int dp[2000];
int main() {
  map<int, vector<pair<int, int> > > m;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[0] = 0;
  for (int i = 1; i <= n; i++) dp[i] = dp[i - 1] + a[i];
  int maxx = 0;
  int valuemax = 0;
  for (int r = 1; r <= n; r++)
    for (int l = 1; l <= r; l++) {
      if (m[dp[r] - dp[l - 1]].size() == 0) {
        m[dp[r] - dp[l - 1]].push_back({l, r});
      } else {
        if (m[dp[r] - dp[l - 1]][m[dp[r] - dp[l - 1]].size() - 1].second < l)
          m[dp[r] - dp[l - 1]].push_back({l, r});
      }
      if (m[dp[r] - dp[l - 1]].size() > maxx) {
        maxx = m[dp[r] - dp[l - 1]].size();
        valuemax = dp[r] - dp[l - 1];
      }
    }
  cout << m[valuemax].size() << endl;
  for (int i = 0; i < m[valuemax].size(); i++) {
    cout << m[valuemax][i].first << " " << m[valuemax][i].second << endl;
  }
  return 0;
}
