#include <bits/stdc++.h>
using namespace std;
int n, a[1005], ans_k;
pair<int, int> ans_p[10], cur[10];
bool sorted() {
  for (int i = 1; i <= n; i++)
    if (a[i] != i) return false;
  return true;
}
void reverse(int b, int e) {
  int aux;
  for (; b < e; b++, e--) {
    aux = a[b];
    a[b] = a[e];
    a[e] = aux;
  }
}
void dfs(int k) {
  if (ans_k != -1) return;
  if (sorted()) {
    ans_k = k;
    for (int i = 0; i < k; i++) ans_p[i] = cur[i];
    return;
  }
  if (k == 3) return;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (abs(a[i] - a[j + 1]) == 1 || abs(a[i - 1] - a[j]) == 1) {
        reverse(i, j);
        cur[k].first = i;
        cur[k].second = j;
        dfs(k + 1);
        reverse(i, j);
      }
}
int main() {
  scanf("%d", &n);
  a[0] = 0;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  a[n + 1] = n + 1;
  ans_k = -1;
  dfs(0);
  printf("%d\n", ans_k);
  for (int i = ans_k - 1; i >= 0; i--)
    printf("%d %d\n", ans_p[i].first, ans_p[i].second);
  return 0;
}
