#include <bits/stdc++.h>
using namespace std;
int n;
int a[1011];
deque<pair<int, int> > ans;
bool dfs() {
  if (ans.size() > 3) return false;
  bool ok = true;
  for (int i = 1; i <= n; i++) {
    if (a[i] != i) {
      ok = false;
      break;
    }
  }
  if (ok) return true;
  int bad = 0;
  set<int> s;
  for (int i = 0; i <= n; i++) {
    if (abs(a[i] - a[i + 1]) != 1) {
      s.insert(i + 1);
      s.insert(i + 2);
      bad++;
    }
  }
  if (bad > 2 * (3 - ans.size())) return false;
  vector<int> v((s).begin(), (s).end());
  for (int i = 0; i < v.size(); i++) {
    for (int j = i + 1; j < v.size(); j++) {
      if (abs(v[i] - v[j]) > 1) {
        ans.push_back(pair<int, int>(v[i], v[j]));
        reverse(a + v[i], a + v[j]);
        if (dfs()) {
          return true;
        }
        reverse(a + v[i], a + v[j]);
        ans.pop_back();
      }
    }
  }
  return false;
}
void solve() {
  ans.clear();
  if (!dfs()) cout << "Impossible" << endl;
  vector<pair<int, int> > vec((ans).begin(), (ans).end());
  reverse((vec).begin(), (vec).end());
  printf("%ld\n", vec.size());
  for (int i = 0; i < vec.size(); i++) {
    printf("%d %d\n", vec[i].first, vec[i].second - 1);
  }
}
void coding() {
  while (scanf("%d", &n) != EOF) {
    a[0] = 0;
    a[n + 1] = n + 1;
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    solve();
  }
}
int main() { coding(); }
