#include <bits/stdc++.h>
using namespace std;
int n, a[1000];
vector<int> pos[4];
int l[3], r[3];
bool done = false;
void solve(int mov) {
  pos[mov].clear();
  pos[mov].push_back(0);
  for (int i = 1; i + 1 < n; ++i)
    if (abs(a[i] - a[i - 1]) != 1 || abs(a[i] - a[i + 1]) != 1)
      pos[mov].push_back(i);
  pos[mov].push_back(n - 1);
  int m = pos[mov].size();
  if (m > 14 - 4 * mov || (mov > 0 && pos[mov].size() > pos[mov - 1].size()))
    return;
  if (m == 2 && a[1] > a[0]) {
    done = true;
    cout << mov << '\n';
    for (int i = mov - 1; i >= 0; --i)
      cout << l[i] + 1 << ' ' << r[i] + 1 << '\n';
  } else if (mov < 3) {
    for (int i = 0; i < m; ++i) {
      for (int j = i + 1; j < m; ++j) {
        l[mov] = pos[mov][i];
        r[mov] = pos[mov][j];
        for (int x = pos[mov][i], y = pos[mov][j]; x < y; ++x, --y)
          swap(a[x], a[y]);
        solve(mov + 1);
        if (done) return;
        for (int x = pos[mov][i], y = pos[mov][j]; x < y; ++x, --y)
          swap(a[x], a[y]);
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  solve(0);
  return 0;
}
