#include <bits/stdc++.h>
using namespace std;
const long long MXN = 50 + 10;
long long n, sum, jam, p, ans, id;
long long A[MXN], ps[MXN], dp[MXN][MXN][MXN];
vector<long long> Sum;
void Set(long long pos, long long val, long long fixL) {
  jam = A[pos], p = pos - 1;
  while (p >= fixL && jam != val) {
    jam += A[p];
    p--;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> A[i], ps[i] = A[i];
  for (int i = 1; i <= n; i++) ps[i] += ps[i - 1];
  for (int l = 1; l <= n; l++) {
    Sum.clear(), sum = 0;
    for (int r = l; r <= n; r++) {
      sum += A[r];
      Sum.push_back(sum);
    }
    for (int i = l; i <= n; i++) {
      for (int j = 0; j < Sum.size(); j++) {
        Set(i, Sum[j], l);
        if (i > l) dp[l][i][j] = dp[l][i - 1][j];
        if (jam != Sum[j]) continue;
        dp[l][i][j] = max(dp[l][i][j], 1 + (p >= l ? dp[l][p][j] : 0));
        ans = max(ans, dp[l][i][j]);
        if (ans == dp[l][i][j]) id = Sum[j];
      }
    }
  }
  cout << ans << '\n';
  long long now = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = now; j <= i; j++) {
      sum = ps[i] - ps[j - 1];
      if (sum == id) {
        cout << j << ' ' << i << endl;
        now = i + 1;
        break;
      }
    }
  }
  return 0;
}
