#include <bits/stdc++.h>
using namespace std;
void optimise() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
long long int mod = 998244353;
long long int inf = 1e18 + 6;
void normalize(long long int &a) { a = (a + mod) % mod; }
long long int modmul(long long int a, long long int b) {
  a = a % mod;
  b = b % mod;
  normalize(a);
  normalize(b);
  return (a * b) % mod;
}
long long int modadd(long long int a, long long int b) {
  a = a % mod;
  b = b % mod;
  normalize(a);
  normalize(b);
  return (a + b) % mod;
}
long long int modsub(long long int a, long long int b) {
  a = a % mod;
  b = b % mod;
  normalize(a);
  normalize(b);
  return (a - b + mod) % mod;
}
long long int me(long long int x, long long int n) {
  x %= mod;
  if (n == 0) return 1;
  long long int u = me(x, n / 2) % mod;
  u = (u * u) % mod;
  if (n % 2) u = (u * x) % mod;
  return u;
}
long long int me1(long long int x, long long int n) {
  if (n == 0) return 1;
  long long int u = me1(x, n / 2);
  u = u * u;
  if (n % 2) u = u * x;
  return u;
}
inline long long int modInv(long long int a) { return me(a, mod - 2); }
inline long long int modDiv(long long int a, long long int b) {
  return modmul(a, modInv(b));
}
long long int __gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return __gcd(b, a % b);
}
const long long int N = 1e6 + 1;
vector<long long int> G[N];
void solve() {
  long long int n;
  cin >> n;
  long long int a[n + 1];
  long long int sum[n + 1];
  sum[0] = 0;
  for (long long int i = 1; i <= n; ++i) {
    cin >> a[i];
    sum[i] = sum[i - 1] + a[i];
  }
  map<long long int, vector<pair<long long int, long long int> > > m;
  for (long long int i = 1; i <= n; i++) {
    for (long long int j = 1; j + i - 1 <= n; j++) {
      long long int sum1 = sum[i + j - 1] - sum[j - 1];
      m[sum1].push_back({j + i - 1, j});
    }
  }
  long long int max1 = 0;
  long long int ans = -1;
  for (auto i = m.begin(); i != m.end(); i++) {
    sort(m[i->first].begin(), m[i->first].end());
    long long int j1 = 0;
    long long int r = 0;
    long long int sum1 = i->first;
    for (auto j = m[sum1].begin(); j != m[sum1].end(); j++) {
      if (j->second > r) {
        j1++;
        r = j->first;
      }
    }
    if (j1 > max1) {
      ans = sum1;
      max1 = j1;
    }
  }
  cout << max1 << "\n";
  long long int r = 0;
  for (auto k1 = m[ans].begin(); k1 != m[ans].end(); k1++) {
    if (k1->second > r) {
      cout << k1->second << " " << k1->first << "\n";
      r = k1->first;
    }
  }
}
signed main() {
  optimise();
  long long int t;
  t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
}
