#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007LL;
bool isValid(vector<int> chk) {
  for (int i = 0; i < chk.size(); i++) {
    if (chk[i] != i + 1) return false;
  }
  return true;
}
vector<int> arr, ans;
int n;
bool go(int cnt) {
  if (isValid(arr)) return true;
  if (cnt == 3) return false;
  vector<int> v;
  v.push_back(0);
  for (int i = 1; i < n - 1; i++) {
    if (abs(arr[i] - arr[i - 1]) != 1 || abs(arr[i + 1] - arr[i]) != 1) {
      v.push_back(i);
    }
  }
  v.push_back(n - 1);
  for (int i = 0; i < v.size(); i++) {
    for (int j = i + 1; j < v.size(); j++) {
      reverse(arr.begin() + v[i], arr.begin() + v[j] + 1);
      if (go(cnt + 1)) {
        ans.push_back(v[i]), ans.push_back(v[j]);
        return true;
      }
      reverse(arr.begin() + v[i], arr.begin() + v[j] + 1);
    }
  }
  return false;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    arr.push_back(x);
  }
  go(0);
  cout << ans.size() / 2 << "\n";
  for (int i = 0; i < ans.size(); i += 2) {
    cout << ans[i] + 1 << " " << ans[i + 1] + 1 << "\n";
  }
  cout << "\n";
  return 0;
}
