#include <bits/stdc++.h>
using namespace std;
struct sequence {
  int mn = INT_MAX;
  int mx = INT_MIN;
  int cnt = 0;
  int second_element = INT_MIN;
  int before_last_element = INT_MAX;
};
int main() {
  sequence seq[(int)1e5 + 10];
  int x[(int)1e5 + 10], i, mx = 1, n, lst = 0, c, s = 1;
  cin >> n;
  for (i = 0; i < n; i++) cin >> x[i];
  seq[0].cnt = 1;
  seq[0].mn = x[0];
  seq[0].mx = x[0];
  x[n] = INT_MIN;
  i = 0;
  if (x[i] < x[i + 1]) seq[lst].before_last_element = x[i];
  for (i = 1; i < n; i++) {
    if (x[i] > x[i - 1]) {
      if (s) {
        s = 0;
        seq[lst].second_element = x[i];
      }
      seq[lst].cnt++;
      seq[lst].mn = min(seq[lst].mn, x[i]);
      seq[lst].mx = max(seq[lst].mx, x[i]);
      if (x[i] < x[i + 1]) seq[lst].before_last_element = x[i];
    } else {
      lst++;
      s = 1;
      seq[lst].cnt++;
      seq[lst].mn = min(seq[lst].mn, x[i]);
      seq[lst].mx = max(seq[lst].mx, x[i]);
      if (x[i] < x[i + 1]) seq[lst].before_last_element = x[i];
    }
  }
  for (i = 0; i <= lst; i++) {
    if (seq[i + 1].cnt == 1 && seq[i].mx < seq[i + 2].mn)
      mx = max(mx, seq[i].cnt + seq[i + 1].cnt + seq[i + 2].cnt);
    if (seq[i + 1].cnt == 1 && seq[i].mx >= seq[i + 2].mn)
      mx = max(mx, seq[i].cnt + seq[i + 1].cnt);
    if (seq[i].cnt == 1) mx = max(mx, seq[i].cnt + seq[i + 1].cnt);
    if (seq[i].mx + 1 < seq[i + 1].second_element)
      mx = max(mx, seq[i].cnt + seq[i + 1].cnt);
    if (lst) mx = max(mx, seq[i].cnt + 1);
    if (seq[i].before_last_element < seq[i + 1].mn - 1)
      mx = max(mx, seq[i].cnt + seq[i + 1].cnt);
    mx = max(mx, seq[i].cnt);
  }
  cout << mx << endl;
  return 0;
}
