#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > myset;
std::vector<int> v;
std::vector<pair<int, int> > res;
int n, l[4], r[4];
void check(int x) {
  int i = 1;
  for (i = 1; i <= n; i++) {
    if (v[i] != i) break;
  }
  if (i == n + 1) {
    cout << x << endl;
    for (int i = x - 1; i >= 0; i--) cout << l[i] << " " << r[i] << endl;
    exit(0);
  }
  if (x == 3) return;
  for (i = 1; i < n + 1; i++)
    if (v[i] != i && (abs(v[i] - v[i - 1]) != 1 || abs(v[i + 1] - v[i]) != 1))
      for (int j = i + 1; j <= n; ++j) {
        if (v[j] != j &&
            (abs(v[j] - v[j - 1]) != 1 || abs(v[j + 1] - v[j]) != 1)) {
          l[x] = i;
          r[x] = j;
          reverse(v.begin() + l[x], v.begin() + r[x] + 1);
          check(x + 1);
          reverse(v.begin() + l[x], v.begin() + r[x] + 1);
        }
      }
}
int main() {
  v.push_back(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int y;
    cin >> y;
    v.push_back(y);
  }
  v.push_back(-1);
  check(0);
}
