#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const int nmax = 1510;
const int MOD = (1e9) + 7;
int n;
int p_sum[nmax], a[nmax];
int sum[nmax][nmax], dp[nmax][nmax];
pair<int, int> pred[nmax][nmax];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) p_sum[i] = p_sum[i - 1] + a[i];
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++) sum[i][j] = p_sum[j] - p_sum[i - 1];
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++) {
      dp[i][j] = 1;
      for (int ki = 1; ki < i; ki++)
        for (int kj = ki; kj < i; kj++)
          if (sum[ki][kj] == sum[i][j] && dp[ki][kj] + 1 > dp[i][j]) {
            dp[i][j] = dp[ki][kj] + 1;
            pred[i][j] = {ki, kj};
          }
    }
  pair<int, int> best = {1, 1};
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (dp[i][j] > dp[best.first][best.second]) best = {i, j};
  int steps = dp[best.first][best.second];
  cout << steps << '\n';
  while (steps > 0) {
    cout << best.first << ' ' << best.second << '\n';
    steps--;
    best = pred[best.first][best.second];
  }
  return 0;
}
