#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define lld long double
#define fi first
#define se second
#define vi vector<int>
#define vb vector<bool>
#define vs vector<string>
#define vvi vector<vector<int>>
#define vpii vector<pair<int,int>>
#define vvpii vector<vector<pair<int,int>>>
#define mii map<int,int>
#define pii pair<int,int>
#define pq priority_queue
#define setbits(a) __builtin_popcountll(a)
#define ctz(a) __builtin_ctzll(a)
#define clz(a) __builtin_clzll(a)
#define loop(n) for(int i=0;i<n;i++)
#define fo(i,s,e) for(int i=s;i<e;i++)
#define inn(a,n) int n; cin>>n; vector<int> a(n); for(int i=0;i<n;i++) cin>>a[i];
#define ink(a,n,k) int n,k; cin>>n>>k; vector<int> a(n); for(int i=0;i<n;i++) cin>>a[i];
#define test int t; cin>>t; while(t--)
#define sz(a) (int)a.size()
#define sortf(a) sort(a.begin(),a.end())
#define sortr(a) sort(a.rbegin(),a.rend())
#define all(a) a.begin(),a.end()
#define gsum(a) accumulate(a.begin(),a.end(),0LL)
#define gmax(a) *max_element(a.begin(),a.end())
#define gmin(a) *min_element(a.begin(),a.end())
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
const int mod = 1000000007;
const int N = 200001, inf = 900000000000000;
const lld eps = 1e-6, pi = 3.1415926535897932;
const long long INF = 1e18+5;
//********PEN CHALAO PAPER PAI SAWAL HO SAKTA HAI****************//
void solve(){
int n;
cin>>n;
vi v(n+1);
for(int i=1; i<=n; i++)cin>>v[i];
int leftmax[n+1];
int rightmax[n+1];
rightmax[n+1]=0;
leftmax[0]=0;
for(int i=1; i<n+1; i++){
if(i==1 || v[i]<=v[i-1]){
leftmax[i]=1;
}else{
leftmax[i]=1+leftmax[i-1];
}
}
for(int j=n; j>=1; j--){
if(j==n || v[j]>=v[j+1]){
rightmax[j]=1;
}else{
rightmax[j]=1+rightmax[j+1];
}
}
// for(int i=1; i<n+1; i++)cout<<leftmax[i]<<" ";
// cout<<"\n";
// for(int j=1; j<n+1; j++)cout<<rightmax[j]<<" ";
int ans =1;
if(n==2)ans =2;
for(int j=1; j<=n; j++){
if(v[j+1]-v[j-1]>=2){
ans = max(ans, leftmax[j-1]+rightmax[j+1]+1);
}else{
ans = max(ans, leftmax[j-1]+1);
ans = max(ans, rightmax[j+1]+1);
}
}
cout<<ans<<endl;
}
int32_t main()
{
fastio;
//code goes here
int t=1;
//cin>>t;
while(t--){
solve();
}
}
672. Richest Customer Wealth | 1470. Shuffle the Array |
1431. Kids With the Greatest Number of Candies | 1480. Running Sum of 1d Array |
682. Baseball Game | 496. Next Greater Element I |
232. Implement Queue using Stacks | 844. Backspace String Compare |
20. Valid Parentheses | 746. Min Cost Climbing Stairs |
392. Is Subsequence | 70. Climbing Stairs |
53. Maximum Subarray | 1527A. And Then There Were K |
1689. Partitioning Into Minimum Number Of Deci-Binary Numbers | 318. Maximum Product of Word Lengths |
448. Find All Numbers Disappeared in an Array | 1155. Number of Dice Rolls With Target Sum |
415. Add Strings | 22. Generate Parentheses |
13. Roman to Integer | 2. Add Two Numbers |
515. Find Largest Value in Each Tree Row | 345. Reverse Vowels of a String |
628. Maximum Product of Three Numbers | 1526A - Mean Inequality |
1526B - I Hate 1111 | 1881. Maximum Value after Insertion |
237. Delete Node in a Linked List | 27. Remove Element |