#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int a[N], n;
vector<pair<int, int> > ans;
inline bool isok(void) {
  for (int i = 1; i <= n; i++)
    if (a[i] != i) return 0;
  return 1;
}
inline bool bt(int t) {
  if (isok()) return 1;
  if (!t) return 0;
  vector<int> pos;
  pos.push_back(1);
  for (int i = 2; i < n; i++)
    if (!(abs(a[i] - a[i - 1]) == 1 && abs(a[i] - a[i + 1]) == 1))
      pos.push_back(i);
  pos.push_back(n);
  for (int i = 0; i < (int)pos.size(); i++)
    for (int j = i + 1; j < (int)pos.size(); j++) {
      reverse(a + pos[i], a + pos[j] + 1);
      if (bt(t - 1)) {
        ans.push_back({pos[i], pos[j]});
        return 1;
      }
      reverse(a + pos[i], a + pos[j] + 1);
    }
  return 0;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  bt(3);
  printf("%d\n", (int)ans.size());
  for (int i = 0; i < (int)ans.size(); i++)
    printf("%d %d\n", ans[i].first, ans[i].second);
  return 0;
}
