#include <bits/stdc++.h>
using namespace std;
int n;
int seq[1000];
bool check(int *a) {
  for (int i = 0; i < n; ++i)
    if (a[i] != i + 1) return false;
  return true;
}
void seqSwap(int *seq, int f, int t) {
  if (f > t)
    seqSwap(seq, t, f);
  else {
    int *a = seq + f, *b = seq + t;
    int tmp;
    while (a < b) {
      tmp = *a;
      *a = *b;
      *b = tmp;
      ++a;
      --b;
    }
  }
}
vector<int> breaks;
bool search(int *seq, int depth) {
  if (check(seq)) {
    printf("%d\n", depth);
    return true;
  }
  if (depth == 3) return false;
  for (int i = 0; i < breaks.size(); ++i) {
    for (int j = i + 1; j < breaks.size(); ++j) {
      if (breaks[i] == breaks[j]) continue;
      int f = breaks[i], t = breaks[j];
      seqSwap(seq, f, t);
      for (int k = i + 1; k < j; ++k) breaks[k] = f + t - breaks[k];
      reverse(breaks.begin() + i + 1, breaks.begin() + j);
      if (search(seq, depth + 1)) {
        printf("%d %d\n", f + 1, t + 1);
        return true;
      }
      seqSwap(seq, f, t);
      for (int k = i + 1; k < j; ++k) breaks[k] = f + t - breaks[k];
      reverse(breaks.begin() + i + 1, breaks.begin() + j);
    }
  }
  return false;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", seq + i);
  if (seq[0] != 1) breaks.push_back(0);
  for (int i = 1; i < n; ++i)
    if (((seq[i] - seq[i - 1]) > 0 ? (seq[i] - seq[i - 1])
                                   : -(seq[i] - seq[i - 1])) != 1) {
      breaks.push_back(i - 1);
      breaks.push_back(i);
    }
  if (seq[n - 1] != n) breaks.push_back(n - 1);
  sort(breaks.begin(), breaks.end());
  search(seq, 0);
}
