#include <bits/stdc++.h>
using namespace std;
const int maxx = 1e6 + 7;
long long n, cnt, id, ans, sum[3 * maxx], a[maxx];
vector<pair<int, int>> ve[3 * maxx];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  for (int i = 0; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      sum[++cnt] = a[j] - a[i];
    }
  }
  sort(sum + 1, sum + 1 + cnt);
  cnt = unique(sum + 1, sum + 1 + cnt) - sum - 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= i; j++) {
      long long temp = a[i] - a[j - 1];
      int q = lower_bound(sum + 1, sum + 1 + cnt, temp) - sum;
      ve[q].push_back(make_pair(j, i));
    }
  }
  for (int i = 1; i <= cnt; i++) {
    long long temp = 0;
    for (int j = 0, t = 0; j < ve[i].size(); j++) {
      if (ve[i][j].first > t) {
        temp++;
        t = ve[i][j].second;
      }
    }
    if (ans < temp) id = i;
    ans = max(ans, temp);
  }
  cout << ans << endl;
  for (int i = 0, t = 0; i < ve[id].size(); i++) {
    if (ve[id][i].first > t) {
      cout << ve[id][i].first << " " << ve[id][i].second << endl;
      t = ve[id][i].second;
    }
  }
}
