#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  if (n == 1) {
    cout << 1;
    return 0;
  }
  int a[n + 10];
  for (int i = 1; i <= n; ++i) cin >> a[i];
  if (n == 1) {
    cout << 1 << '\n';
    return 0;
  }
  map<int, bool> us;
  int kol = 0;
  pair<int, int> x;
  a[0] = -1e9;
  int l = 1, r = 2, ans = 0;
  int ind = 0;
  x = {a[1], 1};
  while (l <= n) {
    if (a[r] > x.first) {
      ans = max(ans, r - l + 1);
      if (r < n) {
        x = {a[r], r};
        ++r;
      } else {
        ++l;
        if (l >= ind) kol = 0;
      }
      continue;
    } else {
      if (kol == 0) {
        ind = r - 1;
        if (r - 2 < l)
          x = {a[r], r};
        else if (r - 2 >= l && a[r] > a[r - 2] && a[r] - a[r - 2] > 1)
          x = {a[r], r};
        else
          x = {a[r - 1] + 1, r};
        ++kol;
        ans = max(ans, r - l + 1);
        if (r < n)
          ++r;
        else {
          ++l;
        }
      } else {
        ans = max(ans, r - l);
        ++l;
        if (l == ind) x = {a[r - 1], r - 1};
        if (l > ind) {
          kol = 0;
          x = {a[r - 1], r - 1};
        }
      }
    }
  }
  cout << ans << '\n';
  return 0;
}
