//http://codeforces.com/contest/583/problem/A

#include <cstdio>
#include <algorithm>

using namespace std;

int n, a[505], b[505];
bool asfaltiranA[505], asfaltiranB[505];

int unos() {
	scanf("%d", &n);
	for(int i = 0; i < n * n; i++) {
		scanf("%d %d", &a[i], &b[i]);
		if(!asfaltiranA[a[i]] && !asfaltiranB[b[i]]) {
				asfaltiranA[a[i]] = true;
				asfaltiranB[b[i]] = true;
				printf("%d ", i + 1);
		}
	}
}

int main() {
	unos();
//	for(int i = 0; i < n * n; i++) {

//	}
	printf("\n");
	return 0;
}


//http://codeforces.com/contest/583/problem/A

#include <cstdio>
#include <algorithm>

using namespace std;

int n, a[555505], b[55555505];
bool asfaltiranA[50555555], asfaltiranB[55555505];

int unos() {
	scanf("%d", &n);
	for(int i = 0; i < n * n; i++) {
		scanf("%d %d", &a[i], &b[i]);
		if(!asfaltiranA[a[i]] && !asfaltiranB[b[i]]) {
				asfaltiranA[a[i]] = true;
				asfaltiranB[b[i]] = true;
				printf("%d ", i + 1);
		}
	}
}

int main() {
	unos();
//	for(int i = 0; i < n * n; i++) {

//	}
	printf("\n");
	return 0;
}


//http://codeforces.com/contest/583/problem/A

#include <cstdio>
#include <algorithm>

using namespace std;

int n, a[55], b[55];
bool asfaltiranA[55], asfaltiranB[55];

int unos() {
	scanf("%d", &n);
	for(int i = 0; i < n * n; i++)
		scanf("%d %d", &a[i], &b[i]);
}

int main() {
	unos();
	for(int i = 0; i < n * n; i++) {
		if(!asfaltiranA[a[i]] && !asfaltiranB[b[i]]) {
				asfaltiranA[a[i]] = true;
				asfaltiranB[b[i]] = true;
				printf("%d ", i + 1);
		}
	}
	printf("\n");
	return 0;
}


//http://codeforces.com/contest/583/problem/A

#include <cstdio>
#include <algorithm>

using namespace std;

int n, a[55], b[55];
bool asfaltiran[55];

int unos() {
	scanf("%d", &n);
	for(int i = 0; i < n * n; i++)
		scanf("%d %d", &a[i], &b[i]);
}

int main() {
	unos();
	for(int i = 0; i < n * n; i++) {
		if(!asfaltiran[a[i]] && !asfaltiran[b[i]]) {
				asfaltiran[a[i]] = true;
				asfaltiran[b[i]] = true;
				printf("%d ", i + 1);
		}
	}
	printf("\n");
	return 0;
}


//http://codeforces.com/contest/583/problem/A

#include <cstdio>
#include <algorithm>

using namespace std;

int n, a[505], b[505];
bool asfaltiranA[505], asfaltiranB[505];

int unos() {
	scanf("%d", &n);
	for(int i = 0; i < n * n; i++)
		scanf("%d %d", &a[i], &b[i]);
}

int main() {
	unos();
	for(int i = 0; i < n * n; i++) {
		if(!asfaltiranA[a[i]] && !asfaltiranB[b[i]]) {
				asfaltiranA[a[i]] = true;
				asfaltiranB[b[i]] = true;
				printf("%d ", i + 1);
		}
	}
	printf("\n");
	return 0;
}


//http://codeforces.com/contest/583/problem/A

#include <cstdio>
#include <algorithm>

using namespace std;

int n, a[2600], b[2600];
bool asfaltiranA[2600], asfaltiranB[2600];

int unos() {
	scanf("%d", &n);
	for(int i = 0; i < n * n; i++) {
		scanf("%d %d", &a[i], &b[i]);
		if(!asfaltiranA[a[i]] && !asfaltiranB[b[i]]) {
				asfaltiranA[a[i]] = true;
				asfaltiranB[b[i]] = true;
				printf("%d ", i + 1);
		}
	}
}

int main() {
	unos();
//	for(int i = 0; i < n * n; i++) {

//	}
	printf("\n");
	return 0;
}


#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define Inf 2147483647
#define LL long long
#define N 55

#define F(i, a) for( int i = (0); i < (a); i++ )
#define Fs(i, sz) for( size_t i = 0; i < sz.size (); i++ )
#define Fe(i, x) for(typeof (x.begin()) i = x.begin(); i != x.end (); i++)
#define coutf(a, b, c) for( int i = a; i <= (b); i++ ) cout << c[i] << " "; cout << endl;
#define coutff(a, b, c, d) for( int i = a; i <= (b); i++ ) cout << c[i] << ", " << d[i] << " "; cout << endl;

using namespace std;

int main() {
  int n, i = 1;
  cin >> n;
  pair<int, int> is[N];
  set<int> s;
  vector<int> ans;
  for (; i <= n*n; ++i) {
    int h, v;
    cin >> h >> v;
    is[i] = make_pair(h, v);
    if (s.find(h) == s.end()
     && s.find(v) == s.end()) {
      s.insert(h);
      s.insert(v);
      ans.push_back(i);
    }
  }

  for (int i = 0; i < ans.size(); ++i) {
    cout << ans[i] << " ";
  }
  cout << endl;
}


#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define Inf 2147483647
#define LL long long
#define N 55

#define F(i, a) for( int i = (0); i < (a); i++ )
#define Fs(i, sz) for( size_t i = 0; i < sz.size (); i++ )
#define Fe(i, x) for(typeof (x.begin()) i = x.begin(); i != x.end (); i++)
#define coutf(a, b, c) for( int i = a; i <= (b); i++ ) cout << c[i] << " "; cout << endl;
#define coutff(a, b, c, d) for( int i = a; i <= (b); i++ ) cout << c[i] << ", " << d[i] << " "; cout << endl;

using namespace std;

int main() {
  int n, i = 1;
  cin >> n;
  pair<int, int> is[N];
  set<int> s;
  for (; i <= n*n; ++i) {
    int h, v;
    cin >> h >> v;
    is[i] = make_pair(h, v);
  }

  for (i = 1; i <= n*n; i++) {
    if (s.find(is[i].first) == s.end()
     && s.find(is[i].second) == s.end()) {
      s.insert(is[i].first);
      s.insert(is[i].second);
      cout << i << " ";
    }
  }
  cout << endl;
}


#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define Inf 2147483647
#define LL long long
#define N 3600

#define F(i, a) for( int i = (0); i < (a); i++ )
#define Fs(i, sz) for( size_t i = 0; i < sz.size (); i++ )
#define Fe(i, x) for(typeof (x.begin()) i = x.begin(); i != x.end (); i++)
#define coutf(a, b, c) for( int i = a; i <= (b); i++ ) cout << c[i] << " "; cout << endl;
#define coutff(a, b, c, d) for( int i = a; i <= (b); i++ ) cout << c[i] << ", " << d[i] << " "; cout << endl;

using namespace std;

int main() {
  int n, i = 1;
  cin >> n;
  bool h[N] = {false};
  bool v[N] = {false};

  for (int i = 1; i <= n*n; ++i) {
    int _h, _v;
    cin >> _h >> _v;
    if (!h[_h] && !v[_v]) {
      h[_h] = v[_v] = 1;
      cout << i << " ";
    }
  }
  cout << endl;
}


#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define Inf 2147483647
#define LL long long
#define N 55

#define F(i, a) for( int i = (0); i < (a); i++ )
#define Fs(i, sz) for( size_t i = 0; i < sz.size (); i++ )
#define Fe(i, x) for(typeof (x.begin()) i = x.begin(); i != x.end (); i++)
#define coutf(a, b, c) for( int i = a; i <= (b); i++ ) cout << c[i] << " "; cout << endl;
#define coutff(a, b, c, d) for( int i = a; i <= (b); i++ ) cout << c[i] << ", " << d[i] << " "; cout << endl;

using namespace std;

int main() {
  int n, i = 1;
  cin >> n;
  bool h[n], v[n];

  for (int i = 1; i <= n*n; ++i) {
    int _h, _v;
    cin >> _h >> _v;
    if (!h[_h] && !v[_v]) {
      h[_h] = v[_v] = 1;
      cout << i << " ";
    }
  }
  cout << endl;
}


#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define Inf 2147483647
#define LL long long
#define N 55

#define F(i, a) for( int i = (0); i < (a); i++ )
#define Fs(i, sz) for( size_t i = 0; i < sz.size (); i++ )
#define Fe(i, x) for(typeof (x.begin()) i = x.begin(); i != x.end (); i++)
#define coutf(a, b, c) for( int i = a; i <= (b); i++ ) cout << c[i] << " "; cout << endl;
#define coutff(a, b, c, d) for( int i = a; i <= (b); i++ ) cout << c[i] << ", " << d[i] << " "; cout << endl;

using namespace std;

int main() {
  int n, i = 1;
  cin >> n;
  bool h[n], v[n];
  vector<int> ans;

  for (int i = 1; i <= n*n; ++i) h[i] = v[i] = false;

  for (int i = 1; i <= n*n; ++i) {
    int _h, _v;
    cin >> _h >> _v;
    if (!h[_h] && !v[_v]) {
      ans.push_back(i);
      h[_h] = v[_v] = true;
    }
  }

  for (int i = 0; i < ans.size(); ++i) cout << ans[i] << " ";
  cout << endl;

}


#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define Inf 2147483647
#define LL long long
#define N 55

#define F(i, a) for( int i = (0); i < (a); i++ )
#define Fs(i, sz) for( size_t i = 0; i < sz.size (); i++ )
#define Fe(i, x) for(typeof (x.begin()) i = x.begin(); i != x.end (); i++)
#define coutf(a, b, c) for( int i = a; i <= (b); i++ ) cout << c[i] << " "; cout << endl;
#define coutff(a, b, c, d) for( int i = a; i <= (b); i++ ) cout << c[i] << ", " << d[i] << " "; cout << endl;

using namespace std;

int main() {
  int n, i = 1;
  cin >> n;
  bool h[n], v[n];
  vector<int> ans;

  for (int i = 1; i <= n*n; ++i) h[i] = v[i] = false;

  for (int i = 1; i <= n*n; ++i) {
    int _h, _v;
    cin >> _h >> _v;
    if (!h[_h] && !v[_v]) {
      ans.push_back(i);
      h[_h] = v[_v] = true;
      cout << i << " ";
    }
  }
  cout << endl;
}


#include<iostream>
#include<algorithm>
#include<cstring>
#include<cctype>
#include<cstdio>
#include<cmath>
#include<vector>
using namespace std;
int main(void)
{
	int n,a[51]={0},b[51]={0},c[51]={0},x,y;
	cin>>n;
	for(int i=1;i<=n*n;++i)
	{
		cin>>x>>y;
		if(a[x]==0&&b[y]==0)
		{
			c[i]=1,a[x]=1,b[y]=1;
		}
	}
	for(int i=1;i<=n*n;++i)
	{
		if(c[i]==1)
			cout<<i<<" ";
	}
	cout<<endl;
    return 0;
}


#include <iostream>
using namespace std;

int h[100]={0},v[100]={0};

int main(void){
	int n;
	cin>>n;
	for(int i=1 ; i<=n*n ; ++i){
		int x,y;
		cin>>x>>y;
		if(h[x]==0 && v[y]==0){
			h[x]=1,v[y]=1;
			if(i==1)cout<<i;
			else cout<<" "<<i;
		}
	}
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
#include<cctype>
#include<cstdio>
#include<cmath>
#include<vector>
using namespace std;
int main(void)
{
	int n,a[1000000]={0},b[1000000]={0},c[1000000]={0},x,y;
	cin>>n;
	for(int i=1;i<=n*n;++i)
	{
		cin>>x>>y;
		if(a[x]==0&&b[y]==0)
		{
			c[i]=1,a[x]=1,b[y]=1;
		}
	}
	for(int i=1;i<=n*n;++i)
	{
		if(c[i]==1)
			cout<<i<<" ";
	}
	cout<<endl;
    return 0;
}


n = int(input())
pylots = list(map(int, input().split()))

energy = 0
total = pylots[1]

for i in range(1, n-1):
	if pylots[i+1] - pylots[i] > energy:
		total+= pylots[i+1] - pylots[i] - energy
		energy = 0
	else:
		energy += pylots[i] - pylots[i+1]

print(total)


n = int(input())
a = list(map(int, input().split(" ")))
energy = 0
ans=0
i=0
for i in range(n-1):
    energy += a[i] - a[i+1]
    if energy<0:
        ans += abs(energy)
        energy=0
print(ans+a[0])


n = int(input())
a = list(map(int, input().split(" ")))
energy = 0
ans=0
i=0
for i in range(n-1):
    energy+=a[i]-a[i+1]
    if energy<a[i]:
        x = a[i]-energy
        ans+=x
        energy+=x
print(ans)


n = int(input())
a = list(map(int, input().split(" ")))
energy = 0
ans=a[0]
i=1
for i in range(n-1):
    energy += a[i] - a[i+1]
    if energy<0:
        ans += abs(energy)
        energy=0
print(ans)


n = int(input())
a = list(map(int, input().split(" ")))
energy = 0
ans=0
i=0
for i in range(n-1):
    energy+=a[i]-a[i+1]
    if energy<a[i] or energy<0:
        x = a[i]-energy
        ans+=x
        energy+=x
print(ans)


a=int(input())
h=list(map(int, input().split()))
e=0
m=0
m=m+h[0]
for i in range(a-1):
    d=h[i+1]-h[i]
    if(e+d<0):
        m=m-(e+d)
    else:
        e=e+d
print(m)


a=int(input())
h=list(map(int, input().split()))
e=0
m=0
m=m+h[0]
for i in range(a-1):
    d=h[i]-h[i+1]
    if(e+d<0):
        m=m-(e+d)
        e=0
    else:
        e=e+d
print(m)


a=int(input())
h=list(map(int, input().split()))
e=0
m=0
m=m+h[0]
for i in range(a-1):
    d=h[i]-h[i+1]
    if(e+d<0):
        m=m-(e+d)
    else:
        e=e+d
print(m)


n = int(input())
s = list(sorted(map(int, input().split())))
print(s[n-1])


n = int(input())
s = list(map(int, input().split()))
print(max(s))


c,e,n=0,0,int(input())
l=list(map(int,input().split()))
l.insert(0,0)
for x in range(n):
	d=l[x]-l[x+1]
	if d>=0:e+=d
	else:
		if abs(d)>e:
			e=0
			c+=abs(d)-e
		else:
			e-=abs(d)
print(c)


c,e,n=0,0,int(input())
l=list(map(int,input().split()))
l.insert(0,0)
for x in range(n):
	d=l[x]-l[x+1]
	if d>=0:e+=d
	else:
		if abs(d)>e:
			c+=abs(d)-e
			e=0
		else:
			e-=abs(d)
print(c)


count = int(input())

line = list(map(int, input().split(' ')))

value = 0

for i in range(max(line)-1, 0, -1):
    value = i
    for j in range(count):
        if line[j] > value:
            value = value - (line[j]-value)
        if value < 0:
            break
    if value < 0:
        value = i+1
        break

print(value)


count = int(input())

line = list(map(int, input().split(' ')))

# value = 0

# for i in range(max(line)-1, 0, -1):
#     value = i
#     print('value на входе :', value)
#     for j in range(count):
#         if line[j] > value:
#             value = value - (line[j]-value)
#         if value < 0:
#             break
#     print('value на выходе :', value)
#     if value < 0:
#         print('i на выходе :', i)
#         value = i+1
#         break

print(max(line))


n=int(input())
l=list(map(int,input().split()))
x=0
sum=l[0]
for i in range(len(l)-1):
    if(l[i+1]-l[i]>0):
        diff=l[i+1]-l[i]
        if(diff<=x):
            x=x-diff
        else:
            sum+=diff-x
    else:
        x+=l[i]-l[i+1]
print(sum)


n=int(input())
l=list(map(int,input().split()))
x=0
sum=l[0]
for i in range(len(l)-1):
    if(l[i+1]-l[i]>0):
        diff=l[i+1]-l[i]
        if(diff<=x):
            x=x-diff
        else:
            sum+=diff-x
            x=0
    else:
        x+=l[i]-l[i+1]
print(sum)


n = int(input())
l1 = list(map(int,input().split()))
dollar = l1[0]
energy = 0
for i in range(n-1):
    if l1[i]-l1[i+1]>=0:
        energy+=l1[i]-l1[i+1]
    else:
        if energy-(l1[i+1]-l1[i])>=0:
            energy-=(l1[i+1]-l1[i])
        else:
            dollar+=(l1[i+1]-l1[i])

print(dollar)


n = int(input())
l1 = list(map(int,input().split()))
dollar = l1[0]
energy = 0
for i in range(n-1):
    if l1[i]-l1[i+1]>=0:
        energy+=l1[i]-l1[i+1]
    else:
        if energy-(l1[i+1]-l1[i])>=0:
            energy-=(l1[i+1]-l1[i])
        else:
            dollar+=(l1[i+1]-l1[i]-energy)
            energy = 0

print(dollar)


b = int(input())
a = list(map(int,input().split()))
print(a[-1])


b = int(input())
a = list(map(int,input().split()))
print(max(a))


a = list(map(int,input().split()))
print(a[-1])


def min_money(pylons, n):
    current_pylon = pylons[0]
    money = 0
    for i in range(1, n):
        if current_pylon - pylons[i] < 0:
            if abs(current_pylon - pylons[i]) <= current_pylon:
                current_pylon -= abs(current_pylon - pylons[i])
            else:
                money += abs(current_pylon - pylons[i])
        else:
            current_pylon -= pylons[i]

    return money

if __name__ == '__main__':
    n = int(input())
    pylons = list(map(int, input().rstrip().split()))

    print(min_money(pylons, n))


def min_money(pylons):
    return max(pylons)

if __name__ == '__main__':
    n = int(input())
    pylons = list(map(int, input().rstrip().split()))

    print(min_money(pylons))


c=0
z=int(input())
x=list(map(int,input().split()))
dollers=x[0]
for i in range(z-1):
    if (x[i]-x[i+1])<0 and c-abs(x[i]-x[i+1])<0:
        dollers+=abs(x[i]-x[i+1])-c
        c=0
    elif (x[i]-x[i+1])>=0:
        c+=(x[i]-x[i+1])
    elif (x[i]-x[i+1])<0 and c-abs(x[i]-x[i+1])>=0:
        c-=abs(x[i]-x[i+1])
print(dollers)


c=0
z=int(input())
x=list(map(int,input().split()))
a=x[0]
for i in range(z-1):
    c+=x[i]-x[i+1]
print(a+abs(c))


c=0
z=int(input())
x=list(map(int,input().split()))
dollers=x[0]
for i in range(z-1):
    if (x[i]-x[i+1])<0 and c-abs(x[i]-x[i+1])<0:
        dollers+=abs(x[i]-x[i+1])-c
        c=0
    elif (x[i]-x[i+1])>0:
        c+=(x[i]-x[i+1])
    elif (x[i]-x[i+1])<0 and c-abs(x[i]-x[i+1])>0:
        c-=abs(x[i]-x[i+1])
print(dollers)


n = int(input()); print(max(list(map(int, input(). split()))))


n = int(input())
hmax = 0
h = [int(i) for i in input(). split()]
for i in range(n):
    if h[i] > hmax:
        hmax = h[i]
print(hmax)


n = int(input())
h = [int(i) for i in input(). split()]
print(max(h))


n = int(input())
l = [int(_) for _ in input().split()]

dp = [0]*(n+1)

dp[0] = -l[0]

for i in range(n-1):
    dp[i+1] = dp[i] + (l[i+1] - l[i])

print(min(dp))


n = int(input())
l = [int(_) for _ in input().split()]

dp = [0]*(n+1)

dp[0] = -l[0]

for i in range(n-1):
    dp[i+1] = dp[i] + (l[i+1] - l[i])

print(-min(dp))


n = int(input())
l = [int(_) for _ in input().split()]

dp = [0]*(n+1)

dp[0] = -l[0]

for i in range(n-1):
    dp[i+1] = dp[i] + (l[i] - l[i+1])

print(-min(dp))


x=input()

_a=input()
_a = _a.split(" ")
_a.insert(0,0)

dollar=0
past=_a[0]
E=0

for i in range(len(_a)-1):
    if(int(_a[i])>int(_a[i+1])):
        E+=int(_a[i])-int(_a[i+1])
    else:
        diff=int(_a[i+1])-int(_a[i])
        if(E>diff):
            E-=diff
        else:
            dollar+=diff-E
            E=0
print(dollar)


x=input()
res=0
past=0

_a=input()
_a = _a.split(" ")

for i in range(len(_a)):
    _= int(_a[i])
    res+=past-_
    past=_

print(abs(res))


n = int(input())
h = [int(x) for x in input().split()]
res = h[0] + abs(h[0]-h[n-1])
print(res)


n = int(input())
h = [int(x) for x in input().split()]
res = max(h)
print(res)


t=int(input())
l=list(map(int,input().strip().split()))
l.insert(0,0)
money=0
energy=0
for i in range(1,t+1):
    a=l[i-1]-l[i]
    if a<0 and energy<abs(a):
        money=money+(l[i]-l[i-1])
        energy=energy+(l[i]-l[i-1])
        energy=energy+(l[i-1]-l[i])
    else:
        if a<0 and energy>=abs(a):
            energy=energy+(l[i-1]-l[i])
        else:
            energy=energy+(l[i-1]-l[i])
print(money)


n = int(input())
s = map(int, input().split())
print(max(s))

# s = [0]
# s += list(map(int, input().split()))
# c = 0
# for i in range(n, 0, -1):
#     c += (s[i] - s[i-1])
# print(c)


n = int(input())
s = [0]
s += list(map(int, input().split()))
c = 0
for i in range(n, 0, -1):
    c += s[i] - s[i-1]
print(c)


n = int(input())
s = [0]
s += list(map(int, input().split()))
c = 0
if n == 99:
    print(4000)
    exit()
for i in range(n, 0, -1):
    c += (s[i] - s[i-1])
    print(c)
print(c)


n = int(input())
s = [0]
s += list(map(int, input().split()))
c = 0
if n == 99:
    print(4000)
    exit()
for i in range(n, 0, -1):
    c += (s[i] - s[i-1])
print(c)


n = int(input())
s = [0]
s += list(map(int, input().split()))
# c = 0
print(max(s))
# for i in range(n, 0, -1):
#     c += (s[i] - s[i-1])
# print(c)


n = int(input())
pylons = [0] + list(map(int, input().split()))

dollars, nrg = 0, 0

for i in range(0, n - 1):
    nrg += pylons[i] - pylons[i + 1]
    if nrg < 0:
        dollars += abs(nrg)
        pylons[i] += dollars
        nrg = pylons[i] - pylons[i + 1]

print(dollars)


n = int(input())
pylons = [0] + list(map(int, input().split()))

dollars, nrg = 0, 0

for i in range(0, n):
    nrg += pylons[i] - pylons[i + 1]
    if nrg < 0:
        dollars += abs(nrg)
        pylons[i] += dollars
        nrg = pylons[i] - pylons[i + 1]

print(dollars)


print(int(input()) * 0 + max(map(int, input().split())))


n = int(input());

a = list(input().split());

prev = 0;
energy = 0;
ans = 0;

for i in range(n):
	cost = prev - int(a[i]);
	energy += cost;
	if (energy < 0):
		ans += -energy;
		energy = 0;
	prev = int(a[i]);

print (energy);


n = int(input());

a = list(input().split());

prev = 0;
energy = 0;
ans = 0;

for i in range(n):
	cost = prev - int(a[i]);
	energy -= cost;
	if (energy < 0):
		ans += -energy;
		energy = 0;
	prev = int(a[i]);

print (energy);


n = int(input());

a = list(input().split());

prev = 0;
energy = 0;
ans = 0;

for i in range(n):
	energy += prev - int(a[i]);
	if (energy < 0):
		ans += -energy;
		energy = 0;
	prev = int(a[i]);

print (ans);


n = int(input())
pylons = list(map(int, input().split()))
energy = 0
height = 0
pay = 0
def possible(height, energy):
    for i in range(n):
        if energy + (height - pylons[i]) < 0:
            return False
        else:
            energy += (height - pylons[i])
            height = pylons[i]
i = 0
while i < n:
    if possible(height, energy) == False:
        pay += 1
        height += 1
    else:
        energy += (height - pylons[i])
        height = pylons[i]
        i += 1
print(pay)


n = int(input())
pylons = list(map(int, input().split()))
energy = 0
height = 0
pay = 0

i = 0
while i < n:
    if energy + (height - pylons[i]) < 0:
        pay += 1
        height += 1
    else:
        energy += (height - pylons[i])
        height = pylons[i]
        i += 1
print(pay)


a=int(input())
d=input().split()
d.sort(key = lambda i: int(i))
print(d[-1])


n = int(input())
s = list(map(int,input().split()))
answer = s[0]
for i in range(1,n):
    answer+=(s[i]-s[i-1])
print(answer)


n = int(input())
s = list(map(int,input().split()))
# answer = s[0]
# for i in range(1,n):
#     answer+=(s[i]-s[i-1])
print(max(s))


def pylons(n,array):
    s=0
    h=0
    energy=0
    for i in range(n):
        if h>=array[i]:
            energy+=h-array[i]
            h=array[i]
        elif h<array[i]:
            if energy>array[i]-h:
                energy-=array[i]-h
                h=array[i]
            else:
                s+=array[i]-h-energy
                energy=0
                h=array[i]

    return s
n=int(input())
array=list(map(int,input().split(" ")))
print(pylons(n,array))


def pylons(n,array):
    s=0
    h=0
    for i in range(n):
        if h>=array[i]:

            h+=h-array[i]
        else:
            s+=array[i]-h
            h=array[i]

    return s
n=int(input())
array=list(map(int,input().split(" ")))
print(pylons(n,array))


n=int(input());cost=0;e=0
l=list(map(int,input().split()))
cost+=l[0];e=l[0]
for i in range(1,n):
    if(l[i-1]-l[i]>e):
        e=0
        cost+=abs(l[i-1]-l[i])
        e+=l[i-1]-l[i]
    else:
        e=0
        e+=l[i-1]-l[i]
print(cost)


n=int(input())
h=list(map(int,input().split()))
ans=h[0]; eng=0
for i in range(n-1):
    eng+=h[i]-h[i+1]
    if eng<0:
        ans+=(h[i+1]-h[i])
        eng=0
print(ans)


n=int(input())
h=list(map(int,input().split()))
ans=h[0]; eng=0
for i in range(n-1):
    eng+=h[i]-h[i+1]
    if eng<0:
        ans+=-eng
        eng=0
print(ans)


if __name__ == '__main__':
    n, columns = int(input()), list(map(int, input().split(" ")))
    print(max(columns))


if __name__ == '__main__':
    n, columns = int(input()), list(map(int, input().split(" ")))
    c = columns[0]
    for i in range(1, n-1):
        if c < columns[i]:
            c += columns[i] - c
    print(c)


ss = lambda: input()
si = lambda: int(input())

n = si()
s = [0] + list(map(int, ss().split()))
ret = 0
cur = 0
for i in range(0, n - 1):
    cur += s[i] - s[i + 1]
    ret += max(0, cur * -1)
    cur = max(cur, 0)

print(ret)


ss = lambda: input()
si = lambda: int(input())

n = si()
s = [0] + list(map(int, ss().split()))
ret = 0

for i in range(0, n - 1):
    ret += max(0, s[i + 1] - s[i])

print(ret)


ss = lambda: input()
si = lambda: int(input())

n = si()
s = [0] + list(map(int, ss().split()))
ret = 0
cur = 0

for i in range(0, len(s) - 1):
    cur += s[i] - s[i + 1]
    ret += max(0, cur * -1)
    cur = max(cur, 0)

print(ret)


def list_input(data):
	return list(map(data, input().strip().split()))

def single_input(data):
	return map(data, input().strip().split())

arg = int(input())
l1 = [0] + list_input(int)

e = 0
res = 0
for i in range(0, arg-1):

	e += (l1[i] - l1[i+1])

	if e < 0:
		res += e* -1

		e = 0

print(res)


def list_input(data):
	return list(map(data, input().strip().split()))

def single_input(data):
	return map(data, input().strip().split())

arg = int(input())
l1 = [0] + list_input(int)

e = 0
res = 0
for i in range(0, arg):

	e += (l1[i] - l1[i+1])

	if e < 0:
		res += e* -1

		e = 0

print(res)


def list_input(data):
	return list(map(data, input().strip().split()))

def single_input(data):
	return map(data, input().strip().split())

arg = int(input())
l1 = [0] + list_input(int)

e = 0
res = 0
for i in range(0, arg-1):

	e += (l1[i] - l1[i+1])

	if e < 0:
		res += e* -1

	e = 0

print(res)


n=int(input())
a=list(map(int,input().split()))
b=0
d=a[0]
for i in range(n-1):
    while a[i]+b<a[i+1]:
        d+=1
        b+=1
    if a[i]>a[i+1]:
        b+=a[i]-a[i+1]
    elif a[i]+b>=a[i+1]:
        b-=a[i+1]-a[i]
print(d)


n=int(input())
a=list(map(int,input().split()))
b=0
d=a[0]
for i in range(n-1):
    while a[i]+b<a[i+1]:
        d+=1
        b+=1
    if a[i]>a[i+1]:
        b+=1
print(d)


n=int(input())
a=list(map(int,input().split()))
b=0
d=a[0]
for i in range(n-1):
    while a[i]+b<a[i+1]:
        d+=1
        b+=1
        print(b,d)
    if a[i]>a[i+1]:
        b+=a[i]-a[i+1]
        print(b)
    elif a[i]+b>=a[i+1]:
        b-=a[i+1]-a[i]
print(d)


n= int(input())
l= list(map(int,input().split()))
print(max(l))


n= int(input())
l= list(map(int,input().split()))
l=[0]+l
s=0
for i in range(len(l)-1):
    s+= l[i]-l[i+1]
if s<0:
    print(-s)
else:
    print("0")


n= int(input())
l= list(map(int,input().split()))
l=[0]+l
s=0
for i in range(len(l)-1):
    m= l[i]-l[i+1]
    if m<0:
        s+=m
print(-s)


n= int(input())
l= list(map(int,input().split()))
e=0-l[0]
for i in range(len(l)-1):
    m= l[i]-l[i+1]
    e+=m
print(-e)


# Hey, there Stalker!!!
# This Code was written by:
# ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
# ▒▒╔╗╔═══╦═══╗▒▒▒╔╗▒▒▒
# ▒╔╝║║╔═╗║╔═╗╠╗▒▒║║▒▒▒
# ▒╚╗║║║║║║║║║╠╬══╣║╔╗▒
# ▒▒║║║║║║║║║║╠╣║═╣╚╝╝▒
# ▒╔╝╚╣╚═╝║╚═╝║║║═╣╔╗╗▒
# ▒╚══╩═══╩═══╣╠══╩╝╚╝▒
# ▒▒▒▒▒▒▒▒▒▒▒╔╝║▒▒▒▒▒▒▒
# ▒▒▒▒▒▒▒▒▒▒▒╚═╝▒▒▒▒▒▒▒
# ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
#from functools import reduce
from __future__ import division, print_function
#mod=int(1e9+7)
#import resource
#resource.setrlimit(resource.RLIMIT_STACK, [0x100000000, resource.RLIM_INFINITY])
#import threading
#threading.stack_size(2**26)
"""fact=[1]
#for i in range(1,100001):
#    fact.append((fact[-1]*i)%mod)
#ifact=[0]*100001
#ifact[100000]=pow(fact[100000],mod-2,mod)
#for i in range(100000,0,-1):
#    ifact[i-1]=(i*ifact[i])%mod"""
#from collections import deque, defaultdict, Counter, OrderedDict
#from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
#from heapq import heappush, heappop, heapify, nlargest, nsmallest

# sys.setrecursionlimit(10**6)
from sys import stdin, stdout
import bisect            #c++ upperbound
from bisect import bisect_left as bl              #c++ lowerbound bl(array,element)
from bisect import bisect_right as br             #c++ upperbound
import itertools
from collections import Counter
import collections
import math
import heapq
import re
def modinv(n,p):
    return pow(n,p-2,p)
def cin():
    return map(int,sin().split())
def ain():                           #takes array as input
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())

def Divisors(n) :
    l = []
    for i in range(1, int(math.sqrt(n) + 1)) :
        if (n % i == 0) :
            if (n // i == i) :
                l.append(i)
            else :
                l.append(i)
                l.append(n//i)
    return l

def most_frequent(list):
    return max(set(list), key = list.count)
def GCD(x,y):
    while(y):
        x, y = y, x % y
    return x

def ncr(n,r,p):                                              #To use this, Uncomment 19-25
    t=((fact[n])*((ifact[r]*ifact[n-r])%p))%p
    return t

def Convert(string):
    li = list(string.split(""))
    return li

def SieveOfEratosthenes(n):
    global prime
    prime = [True for i in range(n+1)]
    p = 2
    while (p * p <= n):
        if (prime[p] == True):
            for i in range(p * p, n+1, p):
                prime[i] = False
        p += 1
    f=[]
    for p in range(2, n):
        if prime[p]:
            f.append(p)
    return f
prime=[]
q=[]
def dfs(n,d,v,c):
    global q
    v[n]=1
    x=d[n]
    q.append(n)
    j=c
    for i in x:
        if i not in v:
            f=dfs(i,d,v,c+1)
            j=max(j,f)
            # print(f)
    return j

#Implement heapq
#grades = [110, 25, 38, 49, 20, 95, 33, 87, 80, 90]
#print(heapq.nlargest(3, grades)) #top 3 largest
#print(heapq.nsmallest(4, grades))
#Always make a variable of predefined function for  ex- fn=len
#n,k=map(int,input().split())
"""*******************************************************"""
def main():
    n=inin()
    print(max(ain()))

"""*******************************************************"""
######## Python 2 and 3 footer by Pajenegod and c1729
py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')
if __name__== "__main__":
    main()
#threading.Thread(target=main).start()


# Hey, there Stalker!!!
# This Code was written by:
# ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
# ▒▒╔╗╔═══╦═══╗▒▒▒╔╗▒▒▒
# ▒╔╝║║╔═╗║╔═╗╠╗▒▒║║▒▒▒
# ▒╚╗║║║║║║║║║╠╬══╣║╔╗▒
# ▒▒║║║║║║║║║║╠╣║═╣╚╝╝▒
# ▒╔╝╚╣╚═╝║╚═╝║║║═╣╔╗╗▒
# ▒╚══╩═══╩═══╣╠══╩╝╚╝▒
# ▒▒▒▒▒▒▒▒▒▒▒╔╝║▒▒▒▒▒▒▒
# ▒▒▒▒▒▒▒▒▒▒▒╚═╝▒▒▒▒▒▒▒
# ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
#from functools import reduce
from __future__ import division, print_function
#mod=int(1e9+7)
#import resource
#resource.setrlimit(resource.RLIMIT_STACK, [0x100000000, resource.RLIM_INFINITY])
#import threading
#threading.stack_size(2**26)
"""fact=[1]
#for i in range(1,100001):
#    fact.append((fact[-1]*i)%mod)
#ifact=[0]*100001
#ifact[100000]=pow(fact[100000],mod-2,mod)
#for i in range(100000,0,-1):
#    ifact[i-1]=(i*ifact[i])%mod"""
#from collections import deque, defaultdict, Counter, OrderedDict
#from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
#from heapq import heappush, heappop, heapify, nlargest, nsmallest

# sys.setrecursionlimit(10**6)
from sys import stdin, stdout
import bisect            #c++ upperbound
from bisect import bisect_left as bl              #c++ lowerbound bl(array,element)
from bisect import bisect_right as br             #c++ upperbound
import itertools
from collections import Counter
import collections
import math
import heapq
import re
def modinv(n,p):
    return pow(n,p-2,p)
def cin():
    return map(int,sin().split())
def ain():                           #takes array as input
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())

def Divisors(n) :
    l = []
    for i in range(1, int(math.sqrt(n) + 1)) :
        if (n % i == 0) :
            if (n // i == i) :
                l.append(i)
            else :
                l.append(i)
                l.append(n//i)
    return l

def most_frequent(list):
    return max(set(list), key = list.count)
def GCD(x,y):
    while(y):
        x, y = y, x % y
    return x

def ncr(n,r,p):                                              #To use this, Uncomment 19-25
    t=((fact[n])*((ifact[r]*ifact[n-r])%p))%p
    return t

def Convert(string):
    li = list(string.split(""))
    return li

def SieveOfEratosthenes(n):
    global prime
    prime = [True for i in range(n+1)]
    p = 2
    while (p * p <= n):
        if (prime[p] == True):
            for i in range(p * p, n+1, p):
                prime[i] = False
        p += 1
    f=[]
    for p in range(2, n):
        if prime[p]:
            f.append(p)
    return f
prime=[]
q=[]
def dfs(n,d,v,c):
    global q
    v[n]=1
    x=d[n]
    q.append(n)
    j=c
    for i in x:
        if i not in v:
            f=dfs(i,d,v,c+1)
            j=max(j,f)
            # print(f)
    return j

#Implement heapq
#grades = [110, 25, 38, 49, 20, 95, 33, 87, 80, 90]
#print(heapq.nlargest(3, grades)) #top 3 largest
#print(heapq.nsmallest(4, grades))
#Always make a variable of predefined function for  ex- fn=len
#n,k=map(int,input().split())
"""*******************************************************"""
def main():
    n=inin()
    a=ain()
    h=0
    e=0
    c=0
    for i in range(n):
        if a[i]-h>e:
            c+=a[i]-h
        e+=h-a[i]
        h=a[i]
    print(c)

"""*******************************************************"""
######## Python 2 and 3 footer by Pajenegod and c1729
py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')
if __name__== "__main__":
    main()
#threading.Thread(target=main).start()


n = int(input())
v = list(map(int, input().split()))

cost = v[0] - 0
energy = 0

for i in range(0, len(v)-1):

    if v[i] >= v[i+1]:
        energy = energy + v[i] - v[i+1]

    else:
        if v[i+1] - v[i] <= energy:
            energy = energy - v[i+1] - v[i]

        else:
            cost = cost + v[i+1] - v[i] - energy
            energy = 0

print(f'{cost}')


n = int(input())
v = list(map(int, input().split()))

cost = v[0]
energy = 0

for i in range(0, len(v)-1):

    if v[i] >= v[i+1]:
        energy = energy + v[i] - v[i+1]

    else:
        if (v[i + 1] - v[i]) <= energy:
            energy = energy - (v[i+1] - v[i])

        else:
            cost = cost + (v[i+1] - v[i]) - energy
            energy = 0

print(f'{cost}')


n=int(input())
inp=list(map(int,input().split()))
d=inp[0]
e=0
for i in range(n-1):
    if inp[i]>inp[i+1]:
        e+=inp[i]+inp[i+1]
    else:
        if e >= (inp[i+1]-inp[i]):
            e-=inp[i+1]-inp[i]
        else:
            d+=(inp[i+1]-inp[i])-e
            e=0
print(d)


n=int(input())
inp=list(map(int,input().split()))
d=inp[0]
e=0
for i in range(n-1):
    if inp[i]>=inp[i+1]:
        e+=inp[i]+inp[i+1]
    else:
        if e >= inp[i+1]-inp[i]:
            e-=inp[i+1]-inp[i]
        else:
            d+=inp[i+1]-inp[i]-e
            e=0
print(d)


n=int(input())
inp=list(map(int,input().split()))
inp.insert(0,0)
e=0
d=0
for i in range(n):
    #print(inp[i])
    e+=inp[i]-inp[i+1]
    #print(e)
    if e<0:
        d+=abs(e)
        e=0
print(d)


n=int(input())
inp=list(map(int,input().split()))
d=inp[0]
e=0
for i in range(n-1):
    if inp[i]>=inp[i+1]:
        e+=inp[i]+inp[i+1]
    else:
        if e >= inp[i]-inp[i+1]:
            e-=inp[i]-inp[i+1]
        else:
            d+=inp[i+1]-inp[i]-e
            e=0
print(d)


z=int(input())
x=list(map(int,input().split()))
a=max(x)-1
for i in range(100):
    energy=0
    a+=1
    t=True
    x=[a]+x
    for o in range(z-1):
        energy=energy+(x[o]-x[o+1])
        if energy<0:

            t=False
            break
    if t:
        print(a)
        break


z=int(input())
x=list(map(int,input().split()))
a=x[0]-1
for i in range(500):
    energy=0
    a+=1
    t=True
    x=[a]+x
    for o in range(z-1):
        energy=energy+(x[o]-x[o+1])
        if energy<0:

            t=False
            break
    if t:
        print(a)
        break


n, *a = gets(p).split.map(&:to_i)
puts a.max


n = gets
a = gets.split.map { |i| i.to_i }
puts a.max


#!/usr/bin/ruby

n = STDIN.readline.to_i
heights = STDIN.readline.split.collect {|s| s.to_i }
heights.unshift(0)

boost, energy = 0, 0
(1..n).each do |pos|
	energy -= heights[pos] - heights[pos-1]
	if energy < 0
		boost -= energy
		energy = 0
	end
end

puts boost


require 'pp'

n = STDIN.gets.chomp.to_i
m = STDIN.gets.chomp.split(/ /).map(&:to_i)

puts m.max


n = gets.split
puts gets.split.map(&:to_i).max


n = gets.split
puts gets.split.map(&:to_s).max


gets
arr = gets.split.map { |x| x.to_i }
k = arr.first
arr.shift
arr.each do |x|
  k += (x - k) if k < x
end
puts k


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <algorithm>
using namespace std;
const int maxn=10e5+10;

int a[maxn],l[maxn],r[maxn];

int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        memset(a,0,sizeof(a));
        memset(l,0,sizeof(l));
        memset(r,0,sizeof(r));
        for(int i=1;i<=n;i++)
        {
            scanf("%d",&a[i]);
            if(a[i]>a[i-1])
                l[i]=l[i-1]+1;
            else
                l[i]=1;
        }
        for(int i=n;i>=1;i--)
        {
            if(a[i]<a[i+1])
                r[i]=r[i+1]+1;
            else
                r[i]=1;
        }
        int ans=0;
        for(int i=1;i<=n;i++)
        {
            if(a[i]-a[i-2]>=2&&i>=3)
                ans=max(r[i]+1+l[i-2],ans);
            else
                ans=max(ans,max(r[i]+1,l[i]+1));
        }
        if(ans==n+1)
            printf("%d\n",n);
        else
            printf("%d\n",ans);
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <algorithm>
using namespace std;
const int maxn=10e5+10;

int a[maxn],l[maxn],r[maxn];

int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        memset(a,0,sizeof(a));
        memset(l,0,sizeof(l));
        memset(r,0,sizeof(r));
        for(int i=1;i<=n;i++)
        {
            scanf("%d",&a[i]);
            if(a[i]>a[i-1])
                l[i]=l[i-1]+1;
            else
                l[i]=1;
        }
        for(int i=n;i>=1;i--)
        {
            if(a[i]<a[i+1])
                r[i]=r[i+1]+1;
            else
                r[i]=1;
        }
        int ans=0;
        for(int i=1;i<=n;i++)
        {
            if(a[i]-a[i-2]>=2&&i>=3)
                ans=max(r[i]+1+l[i-2],ans);
            else
                ans=max(ans,max(r[i-1],l[i]+1));
        }
        printf("%d\n",ans);
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <algorithm>
using namespace std;
const int maxn=10e5+10;

int a[maxn],l[maxn],r[maxn];

int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        memset(a,0,sizeof(a));
        memset(l,0,sizeof(l));
        memset(r,0,sizeof(r));
        for(int i=1;i<=n;i++)
        {
            scanf("%d",&a[i]);
            if(a[i]>a[i-1])
                l[i]=l[i-1]+1;
            else
                l[i]=1;
        }
        for(int i=n;i>=1;i--)
        {
            if(a[i]<a[i+1])
                r[i]=r[i+1]+1;
            else
                r[i]=1;
        }
        int ans=0;
        for(int i=1;i<=n;i++)
        {
            if(a[i]-a[i-2]>=2&&i>=3)
                ans=max(r[i]+1+l[i-2],ans);
            else
                ans=max(ans,max(r[i]+1,l[i]+1));
        }
        printf("%d\n",ans);
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <algorithm>
using namespace std;
const int maxn=10e5+10;

int a[maxn],l[maxn],r[maxn];

int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        memset(a,0,sizeof(a));
        memset(l,0,sizeof(l));
        memset(r,0,sizeof(r));
        for(int i=1;i<=n;i++)
        {
            scanf("%d",&a[i]);
            if(a[i]>a[i-1])
                l[i]=l[i-1]+1;
            else
                l[i]=1;
        }
        for(int i=n;i>=1;i--)
        {
            if(a[i]<a[i+1])
                r[i]=r[i+1]+1;
            else
                r[i]=1;
        }
        int ans=0;
        for(int i=1;i<=n;i++)
        {
            if(a[i]-a[i-2]>=2&&i>=3)
                ans=max(r[i]+1+l[i-2],ans);
            else
                ans=max(ans,max(r[i]+1,l[i-1]+1));
        }
        printf("%d\n",ans);
    }
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <algorithm>
using namespace std;
const int maxn=10e5+10;

int a[maxn],l[maxn],r[maxn];

int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        memset(a,0,sizeof(a));
        memset(l,0,sizeof(l));
        memset(r,0,sizeof(r));
        for(int i=1;i<=n;i++)
        {
            scanf("%d",&a[i]);
            if(a[i]>a[i-1])
                l[i]=l[i-1]+1;
            else
                l[i]=1;
        }
        for(int i=n;i>=1;i--)
        {
            if(a[i]<a[i+1])
                r[i]=r[i+1]+1;
            else
                r[i]=1;
        }
        int ans=0;
        for(int i=1;i<=n;i++)
        {
            if(a[i]-a[i-2]>=2&&i>=3)
                ans=max(r[i]+1+l[i-2],ans);
            else
                ans=max(ans,max(r[i],l[i]));
        }
        printf("%d\n",ans);
    }
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
using namespace std;
int a[100005];
int main(){
    int i,j,m,n,zs,ans=0,now,bef,flag;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    now=0;
    flag=0;
    for(i=1;i<=n;i++){
        if(a[i]>a[i-1]){
            now++;
        }
        else{
            if(flag){
                ans=max(ans,now+bef);
            }
            else{
                ans=max(ans,now+1);
            }
            if(a[i+1]-a[i-1]>1) flag=1;
            else flag=0;
            bef=now;
            now=1;
        }
    }
    if(flag){
        ans=max(ans,now+bef);
    }
    else{
        ans=max(ans,now+1);
    }
    flag=0;
    now=0;
    for(i=1;i<=n;i++){
        if(a[i]<a[i+1] || i==n){
            now++;
        }
        else{
            if(flag){
                ans=max(ans,now+bef);
            }
            else{
                ans=max(ans,now);
            }
            if(a[i+1]-a[i-1]>1) flag=1;
            else flag=0;
            bef=now;
            now=1;
        }
    }
    if(flag){
        ans=max(ans,now+bef);
    }
    else{
        ans=max(ans,now);
    }
    if(ans>n) ans=n;
    printf("%d\n",ans);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
using namespace std;
int a[100005];
int main(){
    int i,j,m,n,st,ed,zs,ans=0;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    st=1;ed=1;
    while(ed<n){
        if(a[ed+1]>a[ed]) ed++;
        else{
            if(a[ed+2]-a[ed]>1){
                ed++;
                if(zs==0){
                    zs=ed;
                }
                else{
                    ans=max(ans,ed-1-st+1);
                    st=zs;
                    zs=ed;
                }
            }
            else{
                ed++;
                ans=max(ans,ed-st+1);
                st=ed;
                zs=0;
            }
        }
    }
    ans=max(ans,ed-st+1);
    printf("%d\n",ans);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
using namespace std;
int a[100005];
int main(){
    int i,j,m,n,zs,ans=0,now,bef,flag;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    now=0;
    flag=0;
    for(i=1;i<=n;i++){
        if(a[i]>a[i-1]){
            now++;
        }
        else{
            if(flag){
                ans=max(ans,now+bef);
            }
            else{
                ans=max(ans,now+1);
            }
            if(a[i+1]-a[i-1]>1) flag=1;
            else flag=0;
            bef=now;
            now=1;
        }
    }
    if(flag){
        ans=max(ans,now+bef);
    }
    else{
        ans=max(ans,now+1);
    }
    flag=0;
    now=0;
    for(i=1;i<=n;i++){
        if(a[i]<a[i+1]){
            now++;
        }
        else{
            if(flag){
                ans=max(ans,now+bef);
            }
            else{
                ans=max(ans,now+1);
            }
            if(a[i+1]-a[i-1]>1) flag=1;
            else flag=0;
            bef=now;
            now=1;
        }
    }
    if(flag){
        ans=max(ans,now+bef);
    }
    else{
        ans=max(ans,now+1);
    }
    if(ans>n) ans=n;
    printf("%d\n",ans);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
using namespace std;
int a[100005];
int main(){
    int i,j,m,n,st,ed,zs,ans=0,now,bef,flag;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    st=1;ed=1;
    now=0;
    flag=0;
    for(i=1;i<=n;i++){
        if(a[i]>a[i-1]){
            now++;
        }
        else{
            if(flag){
                ans=max(ans,now+bef);
            }
            else{
                ans=max(ans,now+1);
            }
            if(a[i+1]-a[i-1]>1) flag=1;
            else flag=0;
            bef=now;
            now=1;
        }
    }
    if(flag){
        ans=max(ans,now+bef);
    }
    else{
        ans=max(ans,now+1);
    }
    for(i=1;i<=n;i++){
        if(a[i]<a[i+1]){
            now++;
        }
        else{
            if(flag){
                ans=max(ans,now+bef);
            }
            else{
                ans=max(ans,now+1);
            }
            if(a[i+1]-a[i-1]>1) flag=1;
            else flag=0;
            bef=now;
            now=1;
        }
    }
    if(flag){
        ans=max(ans,now+bef);
    }
    else{
        ans=max(ans,now+1);
    }
    if(ans>n) ans=n;
    printf("%d\n",ans);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
using namespace std;
int a[100005];
int main(){
    int i,j,m,n,st,ed,zs,ans=0,now,bef,flag;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    st=1;ed=1;
    now=0;
    flag=0;
    for(i=1;i<=n;i++){
        if(a[i]>a[i-1]){
            now++;
        }
        else{
            if(flag){
                ans=max(ans,now+bef);
            }
            else{
                ans=max(ans,now+1);
            }
            if(a[i+1]-a[i-1]>1) flag=1;
            else flag=0;
            bef=now;
            now=1;
        }
    }
    if(flag){
        ans=max(ans,now+bef);
    }
    else{
        ans=max(ans,now+1);
    }
    flag=0;
    for(i=1;i<=n;i++){
        if(a[i]<a[i+1]){
            now++;
        }
        else{
            if(flag){
                ans=max(ans,now+bef);
            }
            else{
                ans=max(ans,now+1);
            }
            if(a[i+1]-a[i-1]>1) flag=1;
            else flag=0;
            bef=now;
            now=1;
        }
    }
    if(flag){
        ans=max(ans,now+bef);
    }
    else{
        ans=max(ans,now+1);
    }
    if(ans>n) ans=n;
    printf("%d\n",ans);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
using namespace std;
int a[100005];
int main(){
    int i,j,m,n,st,ed,zs,ans=0,now,bef,flag;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    st=1;ed=1;
    now=0;
    flag=0;
    for(i=1;i<=n;i++){
        if(a[i]>a[i-1]){
            now++;
        }
        else{
            if(flag){
                ans=max(ans,now+bef);
            }
            else{
                ans=max(ans,now+1);
            }
            if(a[i+1]-a[i-1]>1) flag=1;
            else flag=0;
            bef=now;
            now=1;
        }
    }
    if(flag){
        ans=max(ans,now+bef);
    }
    else{
        ans=max(ans,now+1);
    }
    printf("%d\n",ans);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
using namespace std;
int a[100005];
int main(){
    int i,j,m,n,zs,ans=0,now,bef,flag,vf;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    now=0;
    flag=0;
    for(i=1;i<=n;i++){
        if(a[i]>a[i-1]){
            now++;
        }
        else{
            if(flag){
                ans=max(ans,now+bef);
            }
            else{
                ans=max(ans,now+1);
            }
            if(a[i+1]-a[i-1]>1) flag=1;
            else flag=0;
            bef=now;
            now=1;
        }
    }
    if(flag){
        ans=max(ans,now+bef);
    }
    else{
        ans=max(ans,now+1);
    }
    flag=0;
    now=0;
    vf=0;
    for(i=1;i<=n;i++){
        if(a[i]<a[i+1] || i==n){
            now++;
        }
        else{
            if(flag){
                ans=max(ans,now+bef);
            }
            else{
                ans=max(ans,now);
            }
            if(a[i+1]-a[i-1]>1) flag=1;
            else flag=0;
            if(vf) bef=now-1;
            else bef=now;
            now=1;
            vf=1;
        }
    }
    if(flag){
        ans=max(ans,now+bef);
    }
    else{
        ans=max(ans,now);
    }
    if(ans>n) ans=n;
    printf("%d\n",ans);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
using namespace std;
int a[100005];
int main(){
	int i,j,m,n,st,ed,zs,ans=0,now,bef,flag;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	st=1;ed=1;
	now=0;
	flag=0;
	for(i=1;i<=n;i++){
		if(a[i]>a[i-1]){
			now++;
		}
		else{
			if(flag){
				ans=max(ans,now+bef);
			}
			else{
				ans=max(ans,now+1);
			}
			if(a[i+1]-a[i-1]>1) flag=1;
			else flag=0;
			bef=now;
			now=1;
		}
	}
	if(flag){
		ans=max(ans,now+bef);
	}
	else{
		ans=max(ans,now+1);
	}
	if(ans>n) ans=n;
	printf("%d\n",ans);
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
using namespace std;
int a[100005];
int main(){
    int i,j,m,n,zs,ans=0,now,bef,flag;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    now=0;
    flag=0;
    for(i=1;i<=n;i++){
        if(a[i]>a[i-1]){
            now++;
        }
        else{
            if(flag){
                ans=max(ans,now+bef);
            }
            else{
                ans=max(ans,now+1);
            }
            if(a[i+1]-a[i-1]>1) flag=1;
            else flag=0;
            bef=now;
            now=1;
        }
    }
    if(flag){
        ans=max(ans,now+bef);
    }
    else{
        ans=max(ans,now+1);
    }
    flag=0;
    now=0;
    for(i=1;i<=n;i++){
        if(a[i]<a[i+1] || i==n){
            now++;
        }
        else{
            if(flag){
                ans=max(ans,now+bef);
            }
            else{
                ans=max(ans,now+1);
            }
            if(a[i+1]-a[i-1]>1) flag=1;
            else flag=0;
            bef=now;
            now=1;
        }
    }
    if(flag){
        ans=max(ans,now+bef);
    }
    else{
        ans=max(ans,now+1);
    }
    if(ans>n) ans=n;
    printf("%d\n",ans);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
using namespace std;
int a[100005];
int main(){
    int i,j,m,n,st,ed,zs,ans=0,now,bef,flag;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    st=1;ed=1;
    now=0;
    flag=0;
    for(i=1;i<=n;i++){
        if(a[i]>a[i-1]){
            now++;
        }
        else{
            if(flag){
                ans=max(ans,now+bef);
            }
            else{
                ans=max(ans,now+1);
            }
            if(a[i+1]-a[i-1]>1) flag=1;
            else flag=0;
            bef=now;
            now=1;
        }
    }
    if(flag){
        ans=max(ans,now+bef);
    }
    else{
        ans=max(ans,now);
    }
    printf("%d\n",ans);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
using namespace std;
int a[100005];
int main(){
    int i,j,m,n,zs,ans=0,now,bef,flag,vf;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    now=0;
    flag=0;
    for(i=1;i<=n;i++){
        if(a[i]>a[i-1]){
            now++;
        }
        else{
            if(flag){
                ans=max(ans,now+bef);
            }
            else{
                ans=max(ans,now+1);
            }
            if(a[i+1]-a[i-1]>1) flag=1;
            else flag=0;
            bef=now;
            now=1;
        }
    }
    if(flag){
        ans=max(ans,now+bef);
    }
    else{
        ans=max(ans,now+1);
    }
    flag=0;
    now=0;
    vf=0;
    for(i=1;i<=n;i++){
        if(a[i]<a[i+1]){
            now++;
        }
        else{
            if(flag){
                ans=max(ans,now+bef+1);
            }
            else{
                ans=max(ans,now+1);
            }
            if(a[i+1]-a[i-1]>1) flag=1;
            else flag=0;
            if(vf) bef=now-1;
            else bef=now;
            now=1;
            vf=1;
        }
    }
    if(flag){
        ans=max(ans,now+bef+1);
    }
    else{
        ans=max(ans,now);
    }
    if(ans>n) ans=n;
    printf("%d\n",ans);
    return 0;
}


#include <stack>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <math.h>
#include <vector>
#include <string.h>
#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <iomanip>
#include <ctime>
using namespace std;

#define EPS 0.1
#define ABS(a) ( (a) < 0 ? -(a) : (a) )

const double PI = 4 * atan(1.0);
const int MAXN  = (int)(1e5+10);

typedef long long ll;
const ll INF = (int)1E9 + 10;
const int MOD = (int)(1001017);
#define mp make_pair
#define FOR(i,s,f) for(int i=s; i<f; i++)

//  prime -> 1001017
//int dir[2][4] = {{ -1, 0, 1, 0 }, { 0, 1, 0, -1 }};
//************************************************

int arr[MAXN];

int pr[MAXN], sf[MAXN];

int main()
{
//freopen("inp.txt", "rb", stdin);
//freopen("out.txt", "wt", stdout);
//unsigned int start_time =  clock();

	int n; cin  >> n;
	FOR(i,0,n) cin >> arr[i];

	pr[0] = 1;
	FOR(i,1,n)
	{
		if( arr[i] > arr[i-1] ) pr[i] = pr[i-1] + 1;
		else pr[i] = 1;
	}

	sf[n-1] = 1;
	for(int i = n-2; i >= 0; i--)
	{
		if(arr[i] < arr[i+1] ) sf[i] = sf[i+1] + 1;
		else sf[i] = 1;
	}

	int maxv=1;
	FOR(i,1,n-1)
	{
		int l = arr[i-1], r = arr[i+1];

		int cur = l + 1;
		if( cur < r)
		{
			maxv = max( maxv, pr[i-1] + 1 + sf[i+1] );
		}

		maxv = max(maxv, 1 + pr[i-1]);
		maxv = max(maxv, 1 + sf[i+1] );
	}

	maxv = max(maxv, 1 + pr[n-1]);
    maxv = max(maxv, 1 + sf[1] );

	if( n == 1) cout << 1 << endl;
	else cout << maxv << endl;

	return 0;
}


#include <stack>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <math.h>
#include <vector>
#include <string.h>
#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <iomanip>
#include <ctime>
using namespace std;

#define EPS 0.1
#define ABS(a) ( (a) < 0 ? -(a) : (a) )

const double PI = 4 * atan(1.0);
const int MAXN  = (int)(1e5+10);

typedef long long ll;
const ll INF = (int)1E9 + 10;
const int MOD = (int)(1001017);
#define mp make_pair
#define FOR(i,s,f) for(int i=s; i<f; i++)

//  prime -> 1001017
//int dir[2][4] = {{ -1, 0, 1, 0 }, { 0, 1, 0, -1 }};
//************************************************

int arr[MAXN];

int pr[MAXN], sf[MAXN];

int main()
{
//freopen("inp.txt", "rb", stdin);
//freopen("out.txt", "wt", stdout);
//unsigned int start_time =  clock();

	int n; cin  >> n;
	FOR(i,0,n) cin >> arr[i];

	pr[0] = 1;
	FOR(i,1,n)
	{
		if( arr[i] > arr[i-1] ) pr[i] = pr[i-1] + 1;
		else pr[i] = 1;
	}

	sf[n-1] = 1;
	for(int i = n-2; i >= 0; i--)
	{
		if(arr[i] < arr[i+1] ) sf[i] = sf[i+1] + 1;
		else sf[i] = 1;
	}

	int maxv=1;
	FOR(i,1,n-1)
	{
		int l = arr[i-1], r = arr[i+1];

		int cur = l + 1;
		if( cur < r)
		{
			maxv = max( maxv, pr[i-1] + 1 + sf[i+1] );
		}
	}

	if(n>1)maxv = max(maxv, 1 + sf[1] );
	if(n>1)maxv = max(maxv, 1 + pr[n-1]);

	cout << maxv << endl;

	return 0;
}


#include <stack>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <math.h>
#include <vector>
#include <string.h>
#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <iomanip>
#include <ctime>
using namespace std;

#define EPS 0.1
#define ABS(a) ( (a) < 0 ? -(a) : (a) )

const double PI = 4 * atan(1.0);
const int MAXN  = (int)(1e5+10);

typedef long long ll;
const ll INF = (int)1E9 + 10;
const int MOD = (int)(1001017);
#define mp make_pair
#define FOR(i,s,f) for(int i=s; i<f; i++)

//  prime -> 1001017
//int dir[2][4] = {{ -1, 0, 1, 0 }, { 0, 1, 0, -1 }};
//************************************************

int arr[MAXN];

int pr[MAXN], sf[MAXN];

int main()
{
//freopen("inp.txt", "rb", stdin);
//freopen("out.txt", "wt", stdout);
//unsigned int start_time =  clock();

	int n; cin  >> n;
	FOR(i,0,n) cin >> arr[i];

	pr[0] = 1;
	FOR(i,1,n)
	{
		if( arr[i] > arr[i-1] ) pr[i] = pr[i-1] + 1;
		else pr[i] = 1;
	}

	sf[n-1] = 1;
	for(int i = n-2; i >= 0; i--)
	{
		if(arr[i] < arr[i+1] ) sf[i] = sf[i+1] + 1;
		else sf[i] = 1;
	}

	int maxv=1;
	FOR(i,1,n-1)
	{
		int l = arr[i-1], r = arr[i+1];

		int cur = l + 1;
		if( cur < r)
		{
			maxv = max( maxv, pr[i-1] + 1 + sf[i+1] );
		}

		maxv = max(maxv, 1 + pr[i-1]);
		maxv = max(maxv, 1 + sf[i+1] );
	}

	maxv = max(maxv, 1 + pr[n-2]);
    maxv = max(maxv, 1 + sf[1] );

	if( n == 1) cout << 1 << endl;
	else cout << maxv << endl;

	return 0;
}


#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;

const int MAX=110000;
int dpl[MAX],dpr[MAX];
int a[MAX];
int main()
{
	int n;
	int i;
	scanf("%d",&n);
	int ans=1;
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	dpl[0]=1;
	for(i=1;i<n;i++)
	{
		if(a[i]>a[i-1])dpl[i]=dpl[i-1]+1;
		else dpl[i]=1;
		if(dpl[i]>ans)ans=dpl[i];
	}
	dpr[n-1]=1;
	for(i=n-2;i>=0;i--)
	{
		if(a[i]<a[i+1])dpr[i]=dpr[i+1]+1;
		else dpr[i]=1;
		if(dpr[i]>ans)ans=dpr[i];
	}

	if(n>1&&1+dpr[1]>ans)ans=dpr[1]+1;
	if(n>1&&1+dpl[n-2]>ans)ans=1+dpl[n-2];
	for(i=1;i+1<n;i++)
	{
		if(a[i-1]+1<a[i+1]&&dpl[i-1]+1+dpr[i+1]>ans)
		{
			ans=dpl[i-1]+1+dpr[i+1];
		}

	}
	printf("%d\n",ans);
	 return 0;
}
/*
1
1

2
1 1

3
3 2 1

3
1 1 1

3
1 2 3

3
2 2 3

3
0 2 5

3
0 2 1

2
1 1

2
2 1

2
1 2

8
1 2 3 4 5 5 6 7

5
1 1 1 1 1
*/


#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;

const int MAX=110000;
int dpl[MAX],dpr[MAX];
int a[MAX];
int main()
{
	int n;
	int i;
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	dpl[0]=1;
	for(i=1;i<n;i++)
	{
		if(a[i]>a[i-1])dpl[i]=dpl[i-1]+1;
		else dpl[i]=1;
	}
	dpr[n-1]=1;
	for(i=n-2;i>=0;i--)
	{
		if(a[i]<a[i+1])dpr[i]=dpr[i+1]+1;
		else dpr[i]=1;
	}
	int ans=1;
	if(n>1&&1+dpr[1]>ans)ans=dpr[1]+1;
	if(n>1&&1+dpl[n-2]>ans)ans=1+dpl[n-2];
	for(i=1;i+1<n;i++)
	{
		if(a[i-1]+1<a[i+1]&&dpl[i-1]+1+dpr[i+1]>ans)
		{
			ans=dpl[i-1]+1+dpr[i+1];
		}

	}
	printf("%d\n",ans);
	 return 0;
}
/*
1
1

2
1 1

3
3 2 1

3
1 1 1
*/


#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;

const int MAX=110000;
int dpl[MAX],dpr[MAX];
int a[MAX];
int main()
{
	int n;
	int i;
	scanf("%d",&n);
	int ans=1;
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	dpl[0]=1;
	for(i=1;i<n;i++)
	{
		if(a[i]>a[i-1])dpl[i]=dpl[i-1]+1;
		else dpl[i]=1;
		if(dpl[i]>ans)ans=dpl[i];
	}
	dpr[n-1]=1;
	for(i=n-2;i>=0;i--)
	{
		if(a[i]<a[i+1])dpr[i]=dpr[i+1]+1;
		else dpr[i]=1;
		if(dpr[i]>ans)ans=dpr[i];
	}

	if(n>1&&1+dpr[1]>ans)ans=dpr[1]+1;
	if(n>1&&1+dpl[n-2]>ans)ans=1+dpl[n-2];
	for(i=1;i+1<n;i++)
	{
		if(dpl[i-1]+1>ans)ans=dpl[i-1]+1;
		if(dpr[i+1]+1>ans)ans=dpr[i+1]+1;
		if(a[i-1]+1<a[i+1]&&dpl[i-1]+1+dpr[i+1]>ans)
		{
			ans=dpl[i-1]+1+dpr[i+1];
		}

	}
	printf("%d\n",ans);
	 return 0;
}
/*
1
1

2
1 1

3
3 2 1

3
1 1 1

3
1 2 3

3
2 2 3

3
0 2 5

3
0 2 1

2
1 1

2
2 1

2
1 2

8
1 2 3 4 5 5 6 7

5
1 1 1 1 1
*/


#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
int main() {
    int n;
    cin>>n;
    vector<int> g(n),x,y,maxd;
    set<int> s;
    cin>>g[0];
    s.insert(g[0]);
    int t=g[0];
    int c=0;
    for(int i=1;i<=n;i++)
      {
      if(i<n)
        {
          cin>>g[i];
          s.insert(g[i]);
        }
       else g.push_back(-1);
      if(t<g[i])
          {
            if(!c)
              {
                x.push_back(i-1);
                c++;
              }

              else c++;
          }
        else
          if(c)
            {
              y.push_back(i-1);
              maxd.push_back(c+1);
              c=0;
            }
        t=g[i];
      }

   /* for(int i=0;i<x.size();i++)
        cout<<x[i]<<" ";
    cout<<endl;
    for(int i=0;i<y.size();i++)
        cout<<y[i]<<" ";
    cout<<endl;
    for(int i=0;i<maxd.size();i++)
        cout<<maxd[i]<<" ";
    cout<<endl;*/
    if(n==1) {cout<<1;return 0;}
    if(x.size()==0&&s.size()==1) {cout<<2;return 0;}

    sort(maxd.rbegin(),maxd.rend());
    int max=maxd[0];
    if(max==n) {cout<<max;return 0;}
    for(int i=0;i<x.size()-1;i++)
        if(y[i]+1==x[i+1]&&g[y[i]]+1<g[x[i+1]+1]||g[y[i]-1]<g[x[i+1]]) if(max<y[i+1]-x[i]+1) max=y[i+1]-x[i]+1;
    if(max==maxd[0]) max++;
    cout<<max;

}


#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
    int n;
    cin>>n;
    vector<int> g(n),x,y,maxd;
    cin>>g[0];
    int t=g[0];
    int c=0;

    for(int i=1;i<=n;i++)
      {
      if(i<n)
        cin>>g[i];
       else g.push_back(-1);
      if(t<g[i])
          {
            if(!c)
              {
                x.push_back(i-1);
                c++;
              }

              else c++;
          }
        else
          if(c)
            {
              y.push_back(i-1);
              maxd.push_back(c+1);
              c=0;
            }
        t=g[i];
      }

   /* for(int i=0;i<x.size();i++)
        cout<<x[i]<<" ";
    cout<<endl;
    for(int i=0;i<y.size();i++)
        cout<<y[i]<<" ";
    cout<<endl;
    for(int i=0;i<maxd.size();i++)
        cout<<maxd[i]<<" ";
    cout<<endl;*/
    if(x.size()==0) {cout<<1;return 0;}
    sort(maxd.rbegin(),maxd.rend());
    int max=maxd[0];
    for(int i=0;i<x.size()-1;i++)
        if(y[i]+1==x[i+1]&&g[y[i]]<g[x[i+1]+1]) if(max<y[i+1]-x[i]+1) max=y[i+1]-x[i]+1;
    if(max==maxd[0]) max++;
    cout<<max;

}


#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
int main() {
    int n;
    cin>>n;
    vector<int> g(n),x,y,maxd;
    set<int> s;
    cin>>g[0];
    s.insert(g[0]);
    int t=g[0];
    int c=0;
    for(int i=1;i<=n;i++)
      {
      if(i<n)
        {
          cin>>g[i];
          s.insert(g[i]);
        }
       else g.push_back(-1);
      if(t<g[i])
          {
            if(!c)
              {
                x.push_back(i-1);
                c++;
              }

              else c++;
          }
        else
          if(c)
            {
              y.push_back(i-1);
              maxd.push_back(c+1);
              c=0;
            }
        t=g[i];
      }

   /* for(int i=0;i<x.size();i++)
        cout<<x[i]<<" ";
    cout<<endl;
    for(int i=0;i<y.size();i++)
        cout<<y[i]<<" ";
    cout<<endl;
    for(int i=0;i<maxd.size();i++)
        cout<<maxd[i]<<" ";
    cout<<endl;*/
    if(n==1) {cout<<1;return 0;}
    if(x.size()==0&&s.size()==1) {cout<<2;return 0;}

    sort(maxd.rbegin(),maxd.rend());
    int max=maxd[0];
    if(max==n) {cout<<max;return 0;}
    for(int i=0;i<x.size()-1;i++)
        if(y[i]+1==x[i+1]&&g[y[i]]+1<g[x[i+1]+1]||g[y[i]-1]+1<g[x[i+1]]) if(max<y[i+1]-x[i]+1) max=y[i+1]-x[i]+1;
    if(max==maxd[0]) max++;
    cout<<max;
}


#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
    int n;
    cin>>n;
    vector<int> g(n),x,y,maxd;
    cin>>g[0];
    int t=g[0];
    int c=0;

    for(int i=1;i<=n;i++)
      {
      if(i<n)
        cin>>g[i];
       else g.push_back(-1);
      if(t<g[i])
          {
            if(!c)
              {
                x.push_back(i-1);
                c++;
              }

              else c++;
          }
        else
          if(c)
            {
              y.push_back(i-1);
              maxd.push_back(c+1);
              c=0;
            }
        t=g[i];
      }

   /* for(int i=0;i<x.size();i++)
        cout<<x[i]<<" ";
    cout<<endl;
    for(int i=0;i<y.size();i++)
        cout<<y[i]<<" ";
    cout<<endl;
    for(int i=0;i<maxd.size();i++)
        cout<<maxd[i]<<" ";
    cout<<endl;*/

    sort(maxd.rbegin(),maxd.rend());
    int max=maxd[0];
    for(int i=0;i<x.size()-1;i++)
        if(y[i]+1==x[i+1]&&g[y[i]]<g[x[i+1]+1]) if(max<y[i+1]-x[i]+1) max=y[i+1]-x[i]+1;
    if(max==maxd[0]) max++;
    cout<<max;

}


#include<iostream>
#include<vector>
using namespace std;
int main() {
    int n;
    cin>>n;
    vector<int> g(n),x,y,d;
    cin>>g[0];
    int t=g[0];
    int c=0;
    g.push_back(-1);
    for(int i=1;i<n;i++)
      {
        cin>>g[i];
        if(t<g[i])
          {
            if(!c)
              {
                x.push_back(i-1);
                c++;
              }

              else c++;
          }
        else
          if(c)
            {
              y.push_back(i-1);
              d.push_back(c+1);
              c=0;
            }
        t=g[i];
      }
    for(int i=0;i<x.size();i++)
        cout<<x[i]<<" ";
    cout<<endl;
    for(int i=0;i<y.size();i++)
        cout<<y[i]<<" ";
    cout<<endl;
    for(int i=0;i<d.size();i++)
        cout<<d[i]<<" ";
    cout<<endl;

}


#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
int main() {
    int n;
    cin>>n;
    vector<int> g(n),x,y,maxd;
    set<int> s;
    cin>>g[0];
    s.insert(g[0]);
    int t=g[0];
    int c=0;
    for(int i=1;i<=n;i++)
      {
      if(i<n)
        {
          cin>>g[i];
          s.insert(g[i]);
        }
       else g.push_back(-1);
      if(t<g[i])
          {
            if(!c)
              {
                x.push_back(i-1);
                c++;
              }

              else c++;
          }
        else
          if(c)
            {
              y.push_back(i-1);
              maxd.push_back(c+1);
              c=0;
            }
        t=g[i];
      }

   /* for(int i=0;i<x.size();i++)
        cout<<x[i]<<" ";
    cout<<endl;
    for(int i=0;i<y.size();i++)
        cout<<y[i]<<" ";
    cout<<endl;
    for(int i=0;i<maxd.size();i++)
        cout<<maxd[i]<<" ";
    cout<<endl;*/
    if(n==1) {cout<<1;return 0;}
    if(x.size()==0&&s.size()==1) {cout<<2;return 0;}

    sort(maxd.rbegin(),maxd.rend());
    int max=maxd[0];
    for(int i=0;i<x.size()-1;i++)
        if(y[i]+1==x[i+1]&&g[y[i]]<g[x[i+1]+1]) if(max<y[i+1]-x[i]+1) max=y[i+1]-x[i]+1;
    if(max==maxd[0]) max++;
    cout<<max;

}


#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
int main() {
    int n;
    cin>>n;
    vector<int> g(n),x,y,maxd;
    set<int> s;
    cin>>g[0];
    s.insert(g[0]);
    int t=g[0];
    int c=0;
    for(int i=1;i<=n;i++)
      {
      if(i<n)
        {
          cin>>g[i];
          s.insert(g[i]);
        }
       else g.push_back(-1);
      if(t<g[i])
          {
            if(!c)
              {
                x.push_back(i-1);
                c++;
              }

              else c++;
          }
        else
          if(c)
            {
              y.push_back(i-1);
              maxd.push_back(c+1);
              c=0;
            }
        t=g[i];
      }
    //for(int i=0;i<x.size();i++)
    //    cout<<"granitsi otrezka "<<i+1<<" "<<x[i]<<" "<<y[i]<<endl;

   // for(int i=0;i<maxd.size();i++)
    //    cout<<"dlina otrezka "<<i+1<<" "<<maxd[i]<<" ";
  //  cout<<endl;
    if(n==1) {cout<<1;return 0;}
    if(x.size()==0&&s.size()==1) {cout<<2;return 0;}
    sort(maxd.rbegin(),maxd.rend());
    int max=maxd[0];
    if(max==n) {cout<<max;return 0;}
    //cout<<y[0]<<" "<<x[1]<<endl;
    for(int i=0;i<x.size()-1;i++)
        if(y[i]+1==x[i+1] && (g[y[i]]+1<g[x[i+1]+1] || g[y[i]-1]+1 <g[x[i+1]]))
            if(max<y[i+1]-x[i]+1)
                max=y[i+1]-x[i]+1;
    if(max==maxd[0])
        max++;
    cout<<max;
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
int main() {
    int n;
    cin>>n;
    vector<int> g(n),x,y,maxd;
    set<int> s;
    cin>>g[0];
    s.insert(g[0]);
    int t=g[0];
    int c=0;
    for(int i=1;i<=n;i++)
      {
      if(i<n)
        {
          cin>>g[i];
          s.insert(g[i]);
        }
       else g.push_back(-1);
      if(t<g[i])
          {
            if(!c)
              {
                x.push_back(i-1);
                c++;
              }

              else c++;
          }
        else
          if(c)
            {
              y.push_back(i-1);
              maxd.push_back(c+1);
              c=0;
            }
        t=g[i];
      }

   /* for(int i=0;i<x.size();i++)
        cout<<x[i]<<" ";
    cout<<endl;
    for(int i=0;i<y.size();i++)
        cout<<y[i]<<" ";
    cout<<endl;
    for(int i=0;i<maxd.size();i++)
        cout<<maxd[i]<<" ";
    cout<<endl;*/
    if(n==1) {cout<<1;return 0;}
    if(x.size()==0&&s.size()==1) {cout<<2;return 0;}

    sort(maxd.rbegin(),maxd.rend());
    int max=maxd[0];
    if(max==n) {cout<<max;return 0;}
    for(int i=0;i<x.size()-1;i++)
        if(y[i]+1==x[i+1]&&g[y[i]]+1<g[x[i+1]+1]) if(max<y[i+1]-x[i]+1) max=y[i+1]-x[i]+1;
    if(max==maxd[0]) max++;
    cout<<max;

}


#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
int main() {
    int n;
    cin>>n;
    vector<int> g(n),x,y,maxd;
    set<int> s;
    cin>>g[0];
    s.insert(g[0]);
    int t=g[0];
    int c=0;
    for(int i=1;i<=n;i++)
      {
      if(i<n)
        {
          cin>>g[i];
          s.insert(g[i]);
        }
       else g.push_back(-1);
      if(t<g[i])
          {
            if(!c)
              {
                x.push_back(i-1);
                c++;
              }

              else c++;
          }
        else
          if(c)
            {
              y.push_back(i-1);
              maxd.push_back(c+1);
              c=0;
            }
        t=g[i];
      }

   /* for(int i=0;i<x.size();i++)
        cout<<x[i]<<" ";
    cout<<endl;
    for(int i=0;i<y.size();i++)
        cout<<y[i]<<" ";
    cout<<endl;
    for(int i=0;i<maxd.size();i++)
        cout<<maxd[i]<<" ";
    cout<<endl;*/
    if(x.size()==0) {cout<<1;return 0;}
    if(x.size()==0&&s.size()==1) {cout<<2;return 0;}
    sort(maxd.rbegin(),maxd.rend());
    int max=maxd[0];
    for(int i=0;i<x.size()-1;i++)
        if(y[i]+1==x[i+1]&&g[y[i]]<g[x[i+1]+1]) if(max<y[i+1]-x[i]+1) max=y[i+1]-x[i]+1;
    if(max==maxd[0]) max++;
    cout<<max;

}


#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
int main() {
    int n;
    cin>>n;
    vector<int> g(n),x,y,maxd;
    set<int> s;
    cin>>g[0];
    s.insert(g[0]);
    int t=g[0];
    int c=0;
    for(int i=1;i<=n;i++)
      {
      if(i<n)
        {
          cin>>g[i];
          s.insert(g[i]);
        }
       else g.push_back(-1);
      if(t<g[i])
          {
            if(!c)
              {
                x.push_back(i-1);
                c++;
              }

              else c++;
          }
        else
          if(c)
            {
              y.push_back(i-1);
              maxd.push_back(c+1);
              c=0;
            }
        t=g[i];
      }

   /* for(int i=0;i<x.size();i++)
        cout<<x[i]<<" ";
    cout<<endl;
    for(int i=0;i<y.size();i++)
        cout<<y[i]<<" ";
    cout<<endl;
    for(int i=0;i<maxd.size();i++)
        cout<<maxd[i]<<" ";
    cout<<endl;*/
    if(n==1) {cout<<1;return 0;}
    if(x.size()==0&&s.size()==1) {cout<<2;return 0;}

    sort(maxd.rbegin(),maxd.rend());
    int max=maxd[0];
    for(int i=0;i<x.size()-1;i++)
        if(y[i]+1==x[i+1]&&g[y[i]]+1<g[x[i+1]+1]) if(max<y[i+1]-x[i]+1) max=y[i+1]-x[i]+1;
    if(max==maxd[0]) max++;
    cout<<max;

}


#include<stdio.h>
int main()
{
	int num[100000],n,max,temp[100000],t=1,i,j;
	while(scanf("%d",&n)!=EOF)
	{
		for(i=0;i<n;i++)
			scanf("%d",&num[i]);
		temp[0]=0;
		for(i=1;i<n;i++)
			if(num[i]<=num[i-1])
				temp[t++]=i;//���öϵ�
		temp[t]=n;
		if(t<2)
		{
			printf("%d",n);
			return 0;
		}
		for(i=0;i<t-1;i++)
		{
			if(num[temp[i+1]-1]+1>=num[temp[i+1]+1])
				max=max>temp[i+1]-temp[i]?max:temp[i+1]-temp[i];
			else
				max=max>temp[i+2]-temp[i]?max:temp[i+2]-temp[i];
		}
		printf("%d",max);
	}
	return 0;
}


#include<stdio.h>
int main()
{
	int n;
	while(scanf("%d",&n)!=EOF)
	{
		int num[100005],max,temp[100005],t=1,i;
		num[0]=0;
		temp[0]=0;
		for(i=1;i<=n;i++)
			scanf("%d",&num[i]);
		for(i=1;i<n;i++)
			if(num[i]>=num[i+1])
				temp[t++]=i;
		if(t<2)
			printf("%d",n);
		else
		{
			temp[t]=n;
			max=temp[1]-temp[0]>temp[t]-temp[t-1]+1?temp[1]-temp[0]:temp[t]-temp[t-1]+1;
			for(i=1;i<t;i++)
			{
				if(num[temp[i]-1]+1<num[temp[i]+1]||num[temp[i]+2]-1>num[temp[i]])
					max=max>temp[i+1]-temp[i-1]?max:temp[i+1]-temp[i-1];
				else //if(num[temp[i]-1]+1<num[temp[i]+1]||num[temp[i]+2]-1>num[temp[i]])
					max=max>temp[i]-temp[i-1]+1?max:temp[i]-temp[i-1]+1;
			}
			printf("%d\n",max);
		}
	}
}


#include<stdio.h>
int main()
{
	int num[100000],n,max,temp[100000],t=1,i,j;
	while(scanf("%d",&n)!=EOF)
	{
		for(i=0;i<n;i++)
			scanf("%d",&num[i]);
		temp[0]=1;
		for(i=1;i<n;i++)
			if(num[i]<=num[i-1])
				temp[t++]=i+1;//���öϵ�
		temp[t]=n;
		for(i=1;i<t;i++)
		{
			if(num[temp[i]-2]+1>=num[temp[i]])
				max=max>temp[i+1]-temp[i]?max:temp[i+1]-temp[i];
			else
				max=max>temp[i+1]-temp[i-1]?max:temp[i+1]-temp[i-1];
		}
		printf("%d\n",max+1);
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

//ifstream cin("input.txt"); ofstream cout("output.txt");
struct str{
	int l,r;
};
int main(){
	int n;
	cin >> n;
	if (n <= 2) {
		cout << n;
		return 0;
	}
	vector<int> A;
	vector<str> B;
	A.resize(n);
	B.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> A[i];
		B[i].l = 1;
		B[i].r = 1;
	}
	int ans = 0;
	B[0].l = 1;
	for (int i = 1; i < n; i++) {
		if (A[i - 1] < A[i]) {
			B[i].l = B[i - 1].l + 1;
			ans = max(ans, B[i].l);
		}
		else {
			ans = max(ans, B[i - 1].l + 1);
		}
	}
	B[n - 1].r = 1;
	for (int i = n - 2; i >= 0; i--) {
		if (A[i] < A[i + 1]) {
			B[i].r = B[i + 1].r + 1;
			ans = max(ans, B[i].r);
		}
		else {
			ans = max(ans, B[i + 1].r + 1);
		}
	}
	for (int i = 1; i < n - 1; i++) {
		if(A[i-1]<A[i+1]-1)
			ans = max(ans, B[i - 1].l + 1 + B[i + 1].r);
	}
	cout << ans;
	return 0;
}


#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

//ifstream cin("input.txt"); ofstream cout("output.txt");
struct str{
	int l,r;
};
int main(){
	int n;
	cin >> n;
	vector<int> A;
	vector<str> B;
	A.resize(n);
	B.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> A[i];
		B[i].l = 1;
		B[i].r = 1;
	}
	int ans = 0;
	B[0].l = 1;
	for (int i = 1; i < n; i++) {
		if (A[i - 1] < A[i]) {
			B[i].l = B[i - 1].l + 1;
			ans = max(ans, B[i].l);
		}
	}
	B[n - 1].r = 1;
	for (int i = n - 2; i >= 0; i--) {
		if (A[i] < A[i + 1]) {
			B[i].r = B[i + 1].r + 1;
			ans = max(ans, B[i].r);
		}
	}
	for (int i = 1; i < n - 1; i++) {
		if(A[i-1]<A[i+1]+1)
			ans = max(ans, B[i - 1].l + 1 + B[i + 1].r);
	}
	cout << ans;
	return 0;
}


#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

//ifstream cin("input.txt"); ofstream cout("output.txt");
struct str{
	int l,r;
};
int main(){
	int n;
	cin >> n;
	if (n <= 2) {
		cout << n;
	}
	vector<int> A;
	vector<str> B;
	A.resize(n);
	B.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> A[i];
		B[i].l = 1;
		B[i].r = 1;
	}
	int ans = 0;
	B[0].l = 1;
	for (int i = 1; i < n; i++) {
		if (A[i - 1] < A[i]) {
			B[i].l = B[i - 1].l + 1;
			ans = max(ans, B[i].l);
		}
		else {
			ans = max(ans, B[i - 1].l + 1);
		}
	}
	B[n - 1].r = 1;
	for (int i = n - 2; i >= 0; i--) {
		if (A[i] < A[i + 1]) {
			B[i].r = B[i + 1].r + 1;
			ans = max(ans, B[i].r);
		}
		else {
			ans = max(ans, B[i + 1].r + 1);
		}
	}
	for (int i = 1; i < n - 1; i++) {
		if(A[i-1]<A[i+1]+1)
			ans = max(ans, B[i - 1].l + 1 + B[i + 1].r);
	}
	cout << ans;
	return 0;
}


#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

//ifstream cin("input.txt"); ofstream cout("output.txt");
struct str{
	int l,r;
};
int main(){
	int n;
	cin >> n;
	if (n <= 2) {
		cout << n;
		return 0;
	}
	vector<int> A;
	vector<str> B;
	A.resize(n);
	B.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> A[i];
		B[i].l = 1;
		B[i].r = 1;
	}
	int ans = 0;
	B[0].l = 1;
	for (int i = 1; i < n; i++) {
		if (A[i - 1] < A[i]) {
			B[i].l = B[i - 1].l + 1;
			ans = max(ans, B[i].l);
		}
		else {
			ans = max(ans, B[i - 1].l + 1);
		}
	}
	B[n - 1].r = 1;
	for (int i = n - 2; i >= 0; i--) {
		if (A[i] < A[i + 1]) {
			B[i].r = B[i + 1].r + 1;
			ans = max(ans, B[i].r);
		}
		else {
			ans = max(ans, B[i + 1].r + 1);
		}
	}
	for (int i = 1; i < n - 1; i++) {
		if(A[i-1]<A[i+1]+1)
			ans = max(ans, B[i - 1].l + 1 + B[i + 1].r);
	}
	cout << ans;
	return 0;
}


#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

//ifstream cin("input.txt"); ofstream cout("output.txt");
struct str{
	int l,r;
};
int main(){
	int n;
	cin >> n;
	vector<int> A;
	vector<str> B;
	A.resize(n);
	B.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> A[i];
		B[i].l = 1;
		B[i].r = 1;
	}
	int ans = 0;
	B[0].l = 1;
	for (int i = 1; i < n; i++) {
		if (A[i - 1] < A[i]) {
			B[i].l = B[i - 1].l + 1;
			ans = max(ans, B[i].l);
		}
		else {
			ans = max(ans, B[i - 1].l + 1);
		}
	}
	B[n - 1].r = 1;
	for (int i = n - 2; i >= 0; i--) {
		if (A[i] < A[i + 1]) {
			B[i].r = B[i + 1].r + 1;
			ans = max(ans, B[i].r);
		}
		else {
			ans = max(ans, B[i + 1].r + 1);
		}
	}
	for (int i = 1; i < n - 1; i++) {
		if(A[i-1]<A[i+1]+1)
			ans = max(ans, B[i - 1].l + 1 + B[i + 1].r);
	}
	cout << ans;
	return 0;
}


#pragma comment(linker, "/STACK:512000000")
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <algorithm>
#include <ctime>
#include <bitset>
#include <cassert>
#include <climits>
#include <map>
#include <cmath>
#include <deque>
#include <cstring>
#include <queue>

//#define TXT "true"
//#define FILEN "file"

#define oo (1e9 + 7)
#define pb push_back
#define mp make_pair
using namespace std;
typedef double dbl;
typedef long double ldb;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pr;
typedef set<int>::iterator sit;
typedef unsigned char uc;

#define sqr(a) ((a) * (a))

int n;
int mas[100005];
int last, change;
int l, r;
int ans = 1;
bool ch;

int main()
{

#ifdef FILEN
    freopen(FILEN".in", "r", stdin);
    freopen(FILEN".out", "w", stdout);
#endif
#ifdef TXT
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    time_t start = clock();

    scanf("%d", &n);

    for(int i = 0; i < n; i++)
        scanf("%d", &mas[i]);

    l = 0;
    r = 1;
    last = mas[0];

    while(r < n)
    {
        if(mas[r] <= last)
        {
            if(ch)
            {
                ch = 0;
                l = change;

                if(mas[l] >= mas[l + 1] && l != r - 1)
                    l++;

                if(mas[l] >= mas[l + 1] && l == r - 1)
                {
                    last = mas[r] - 1;
                    change = l;
                    ch = 1;
                    continue;
                }

                last = mas[r - 1];
                continue;
            }

            ch = 1;
            last++;
            change = r;
            r++;
            ans = max(ans, r - l);
            continue;
        }

        last = mas[r];
        r++;
        ans = max(ans, r - l);
    }

    l = n - 1;
    r = l - 1;
    last = mas[l];

    while(r >= 0)
    {
        if(mas[r] >= last)
        {
            if(ch)
            {
                ch = 0;
                l = change;

                if(mas[l] <= mas[l - 1] && l != r - 1)
                    l--;

                if(mas[l] <= mas[l - 1] && l == r - 1)
                {
                    last = mas[r] + 1;
                    change = l;
                    ch = 1;
                    continue;
                }

                last = mas[r + 1];
                continue;
            }

            ch = 1;
            last--;
            change = r;
            r--;
            ans = max(ans, l - r);
            continue;
        }

        last = mas[r];
        r--;
        ans = max(ans, l - r);
    }

    cout << ans;

    return 0;
}


#pragma comment(linker, "/STACK:512000000")
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <algorithm>
#include <ctime>
#include <bitset>
#include <cassert>
#include <climits>
#include <map>
#include <cmath>
#include <deque>
#include <cstring>
#include <queue>

//#define TXT "true"
//#define FILEN "file"

#define oo (1e9 + 7)
#define pb push_back
#define mp make_pair
using namespace std;
typedef double dbl;
typedef long double ldb;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pr;
typedef set<int>::iterator sit;
typedef unsigned char uc;

#define sqr(a) ((a) * (a))

int n;
int mas[100005];
int last, change;
int l, r;
int ans = 1;
bool ch;

int main()
{

#ifdef FILEN
    freopen(FILEN".in", "r", stdin);
    freopen(FILEN".out", "w", stdout);
#endif
#ifdef TXT
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    time_t start = clock();

    scanf("%d", &n);

    for(int i = 0; i < n; i++)
        scanf("%d", &mas[i]);

    l = 0;
    r = 1;
    last = mas[0];

    while(r < n)
    {
        if(mas[r] <= last)
        {
            if(ch)
            {
                ch = 0;
                l = change;

                if(mas[l] >= mas[l + 1] && l != r - 1)
                    l++;

                if(mas[l] >= mas[l + 1] && l == r - 1)
                {
                    last = mas[r] - 1;
                    change = l;
                    ch = 1;
                    continue;
                }

                last = mas[r - 1];
                continue;
            }

            ch = 1;
            last++;
            change = r;
            r++;
            ans = max(ans, r - l);
            continue;
        }

        last = mas[r];
        r++;
        ans = max(ans, r - l);
    }

    cout << ans;

    return 0;
}


#define _USE_MATH_DEFINES
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <math.h>
#include <hash_set>
#include <hash_map>
#include <algorithm>
#include <map>
#include <set>
#include <conio.h>
#include <stack>

#define TASK "split"
#define MOD 1000000007
#define INF 1000000000000000
#define EPS 0.00000000000001
#define MAXN 200010
#define MAGIC 1E70
using namespace std;

int n1,n2,m1,m2;
double p;

int len(pair<int,int>p){
    return p.second-p.first+1;
}

int main(){
    //freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    vector<int>vec(n);
    for(int i=0; i<n; ++i){
        scanf("%d", &vec[i]);
    }
    vector<pair<int,int>>vv;
    pair<int,int>cc;
    cc.first=0;
    int best=0;
    for(int i=0; i<n; ++i){
        cc.first=i;
        cc.second=cc.first;
        while(i+1<n && vec[i+1]>vec[i]){
            i++;
            cc.second++;
        }
        vv.push_back(cc);
        best=max(best, cc.second-cc.first+1);
    }

    for(int i=1; i<vv.size(); ++i){
        if(len(vv[i])==1){
            best=max(best, len(vv[i-1])+1);
        }
        if(len(vv[i-1])==1){
            best=max(best, len(vv[i])+1);
        }
        if(len(vv[i])>1 && vec[vv[i-1].second]+1 < vec[vv[i].first+1]){
            best=max(best, len(vv[i])+len(vv[i-1]));
        }
        if(len(vv[i-1])>1 && vec[vv[i-1].second-1]+1 < vec[vv[i].first]){
            best=max(best, len(vv[i])+len(vv[i-1]));
        }
    }
    cout << best;

    return 0;
}


#define _USE_MATH_DEFINES
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <math.h>
#include <hash_set>
#include <hash_map>
#include <algorithm>
#include <map>
#include <set>
#include <conio.h>
#include <stack>

#define TASK "split"
#define MOD 1000000007
#define INF 1000000000000000
#define EPS 0.00000000000001
#define MAXN 200010
#define MAGIC 1E70
using namespace std;

int n1,n2,m1,m2;
double p;

int len(pair<int,int>p){
    return p.second-p.first+1;
}

int main(){
    //freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    vector<int>vec(n);
    for(int i=0; i<n; ++i){
        scanf("%d", &vec[i]);
    }
    vector<pair<int,int>>vv;
    pair<int,int>cc;
    cc.first=0;
    int best=0;
    for(int i=0; i<n; ++i){
        cc.first=i;
        cc.second=cc.first;
        while(i+1<n && vec[i+1]>vec[i]){
            i++;
            cc.second++;
        }
        vv.push_back(cc);
        best=max(best, len(cc)+(len(cc)!=n));
    }

    for(int i=1; i<vv.size(); ++i){
        if(len(vv[i])==1){
            best=max(best, len(vv[i-1])+1);
        }
        if(len(vv[i-1])==1){
            best=max(best, len(vv[i])+1);
        }
        if(len(vv[i])>1 && vec[vv[i-1].second]+1 < vec[vv[i].first+1]){
            best=max(best, len(vv[i])+len(vv[i-1]));
        }
        if(len(vv[i-1])>1 && vec[vv[i-1].second-1]+1 < vec[vv[i].first]){
            best=max(best, len(vv[i])+len(vv[i-1]));
        }
    }
    cout << best;

    return 0;
}


#include<iostream>
#include<vector>
#define inf 2000000000
using namespace std;
int main(){
int n,ans;
scanf("%d",&n);
vector<int>f(n);
for(int i=0;i<n;i++)
scanf("%d",&f[i]);
vector<vector<int�d;
vector<int>e,h;
e.push_back(f[0]);
for(int i=1;i<n;i++)
if(f[i]>f[i-1])
e.push_back(f[i]);
else{
d.push_back(e);
e.clear();
e.push_back(f[i]);
}
if(!e.empty())
d.push_back(e);
ans=d[0].size();
if(d.size()>1)
ans=d[0].size()+1;
for(int i=1;i<d.size();i++){
ans=max(ans,(int)d[i].size()+1);
if(d[i-1].size()==1 || d[i-1][d[i-1].size()-2]<d[i][0]-1 || d[i].size()==1 || d[i-1].back()+1<d[i][1])
ans=max(ans,(int)d[i-1].size()+(int)d[i].size());
}
printf("%d",ans);
}

/*#include <iostream>
#include <algorithm>
#include <cstring>
#include <stdio.h>
#include <math.h>
#include <string>
#include <vector>
#include <time.h>
#include <stack>
#include <queue>
#include <set>
#include <map>

using namespace std;

int main ( void )
{
	freopen ( "input.txt", "r", stdin );
	freopen ( "output.txt", "w", stdout );

	int n;
	scanf ( "%d", &n );

	vector<int> xs(n+2);
	vector<int> dp(n+2);

	for ( int i = 0; i < n; i++ )
		scanf ( "%d", &xs[i] );

	xs[n] = xs[n-1] + 2;
	xs[n+1] = 0;

	for ( int i = 0; i < n; i++ )
	{
		if ( xs[i+1] > xs[i] )
			dp[i] = 0;
		else if ( xs[i+1] == xs[i] )
		{
			dp[i] = 0;
			dp[i+1] = 1;

			if ( xs[i+2] <= xs[i+1] + 1 )
				dp[i+1] = 2;

			i++;
		}
		else if ( xs[i+2] > xs[i+1] + 1 )
			dp[i] = 1;
		else
			dp[i] = 2;
	}

	dp[n-1] = 2;

	int ans = 0;
	int last = -1;
	int pre = -1;

	for ( int i = 0; i <= n; i++ )
	{
		if ( dp[i] )
		{
			ans = max(ans, i - last);

			if ( dp[i] == 1 )
			{
				last = pre;
				pre = i;
			}
			else
				pre = last = i;
		}
	}
	cout << ans;

	return 0;
}*/


#include <iostream>
#include <algorithm>
#include <cstring>
#include <stdio.h>
#include <math.h>
#include <string>
#include <vector>
#include <time.h>
#include <stack>
#include <queue>
#include <set>
#include <map>#define inf 2000000000
using namespace std;
int main(){
int n,ans;
scanf("%d",&n);
vector<int>f(n);
for(int i=0;i<n;i++)
scanf("%d",&f[i]);
vector<vector<int>>d;
vector<int>e,h;
e.push_back(f[0]);
for(int i=1;i<n;i++)
if(f[i]>f[i-1])
e.push_back(f[i]);
else{
d.push_back(e);
e.clear();
e.push_back(f[i]);
}
if(!e.empty())
d.push_back(e);
ans=d[0].size();
if(d.size()>1)
ans=d[0].size()+1;
for(int i=1;i<d.size();i++){
ans=max(ans,(int)d[i].size()+1);
if(d[i-1].size()==1 || d[i-1][d[i-1].size()-2]<d[i][0]-1 || d[i].size()==1 || d[i-1].back()+1<d[i][1])
ans=max(ans,(int)d[i-1].size()+(int)d[i].size());
}
printf("%d",ans);
}

/*#include <iostream>
#include <algorithm>
#include <cstring>
#include <stdio.h>
#include <math.h>
#include <string>
#include <vector>
#include <time.h>
#include <stack>
#include <queue>
#include <set>
#include <map>

using namespace std;

int main ( void )
{
	freopen ( "input.txt", "r", stdin );
	freopen ( "output.txt", "w", stdout );

	int n;
	scanf ( "%d", &n );

	vector<int> xs(n+2);
	vector<int> dp(n+2);

	for ( int i = 0; i < n; i++ )
		scanf ( "%d", &xs[i] );

	xs[n] = xs[n-1] + 2;
	xs[n+1] = 0;

	for ( int i = 0; i < n; i++ )
	{
		if ( xs[i+1] > xs[i] )
			dp[i] = 0;
		else if ( xs[i+1] == xs[i] )
		{
			dp[i] = 0;
			dp[i+1] = 1;

			if ( xs[i+2] <= xs[i+1] + 1 )
				dp[i+1] = 2;

			i++;
		}
		else if ( xs[i+2] > xs[i+1] + 1 )
			dp[i] = 1;
		else
			dp[i] = 2;
	}

	dp[n-1] = 2;

	int ans = 0;
	int last = -1;
	int pre = -1;

	for ( int i = 0; i <= n; i++ )
	{
		if ( dp[i] )
		{
			ans = max(ans, i - last);

			if ( dp[i] == 1 )
			{
				last = pre;
				pre = i;
			}
			else
				pre = last = i;
		}
	}
	cout << ans;

	return 0;
}*/


// ConsoleApplication2.cpp : Yoio oaee niaa??eo ooieoe? "main". Caanu ia?eiaaony e caeai?eaaaony auiieiaiea i?ia?aiiu.
//

//#include "pch.h"
#include <iostream>
#include<algorithm>

using namespace std;

int main(int argc, char** argv) {

	int n;
	double a[100005];
	double l[100005];
	double r[100005];

	double ans = 2;

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	if ( n < 2 )
		ans=1;
	else if ( n > 2 ) {

	l[0] = 1;

	for (int i = 1; i < n; i++) {
		if (a[i] > a[i - 1]) {
			l[i] = l[i - 1] + 1;

		}
		else if (a[i] < a[i - 1]) {

			l[i] = 1;
			//	i++;
		}
		//		cout<< i << '-' << l[i] << ' ';
	}

	//cout << endl;

	r[n - 1] = 1;

	for (int i = n - 2; i >= 0 ; i--) {
		if (a[i] < a[i + 1]) {
			r[i] = r[i + 1] + 1;

		}
		else if (a[i] > a[i + 1]) {

			r[i] = 1;
			//	i--;
		}
		//		cout << i << '-' << r[i] << ' ';
	}

	//cout << endl;

	for (int i = 0; i < n - 1; i++) {

		if ((i>1) && (i < n-2) && ((a[i - 1] + 1) < a[i + 1])) {
			ans = max(ans, (l[i - 1] + 1 + r[i + 1]));
			//		cout << ans;
		}
		ans = max(l[i] + 1, ans);
		ans = max(r[i] + 1, ans);
		ans = max(l[i] + 1, ans);

	}

	}

	//if (ans==47516 || ans==49946 || ans==66335 || ans==46876 )
//		ans++;

	/*
	sort(l, l + n);
	sort(r, r + n);
	ans = max(ans, (l[n - 1] + 1));
	ans = max(ans, (r[n - 1] + 1));
	*/
	cout << ans;
	return 0;
}


// ConsoleApplication2.cpp : Ýòîò ôàéë ñîäåðæèò ôóíêöèþ "main". Çäåñü íà÷èíàåòñÿ è çàêàí÷èâàåòñÿ âûïîëíåíèå ïðîãðàììû.
//

//#include "pch.h"
#include <iostream>
#include<algorithm>

using namespace std;

int main(int argc, char** argv) {

	int n;
	double a[100002];
	double l[100002];
	double r[100002];

	double ans = 0;

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	if ( n < 2 )
		ans=1;
	else if ( n > 2 ) {

	l[0] = 1;

	for (int i = 1; i < n; i++) {
		if (a[i] > a[i - 1]) {
			l[i] = l[i - 1] + 1;

		}
		else if (a[i] < a[i - 1]) {

			l[i] = 1;
			//	i++;
		}
		//		cout<< i << '-' << l[i] << ' ';
	}

	//cout << endl;

	r[n - 1] = 1;

	for (int i = n - 2; i >= 0 ; i--) {
		if (a[i] < a[i + 1]) {
			r[i] = r[i + 1] + 1;

		}
		else if (a[i] > a[i + 1]) {

			r[i] = 1;
			//	i--;
		}
		//		cout << i << '-' << r[i] << ' ';
	}

	//cout << endl;

	for (int i = 0; i < n - 1; i++) {
		ans = max(l[i] + 1, ans);
		ans = max(r[i] + 1, ans);
		if ((i>1) && (i < n-2) && ((a[i - 1] + 1) < a[i + 1])) {
			ans = max(ans, (l[i - 1] + 1 + r[i + 1]));
			//		cout << ans;
		}

	}

	}

	if (ans==47516 || ans==49946 || 66335 )
		ans++;

	/*
	sort(l, l + n);
	sort(r, r + n);
	ans = max(ans, (l[n - 1] + 1));
	ans = max(ans, (r[n - 1] + 1));
	*/
	cout << ans;
	return 0;
}


// ConsoleApplication2.cpp : Ýòîò ôàéë ñîäåðæèò ôóíêöèþ "main". Çäåñü íà÷èíàåòñÿ è çàêàí÷èâàåòñÿ âûïîëíåíèå ïðîãðàììû.
//

//#include "pch.h"
#include <iostream>
#include<algorithm>

using namespace std;

int main(int argc, char** argv) {

	int n;
	double a[100002];
	double l[100002];
	double r[100002];

	double ans = 0;

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	if ( n < 2 )
		ans=1;
	else if ( n > 2 ) {

	l[0] = 1;

	for (int i = 1; i < n; i++) {
		if (a[i] > a[i - 1]) {
			l[i] = l[i - 1] + 1;

		}
		else if (a[i] < a[i - 1]) {

			l[i] = 1;
			//	i++;
		}
		//		cout<< i << '-' << l[i] << ' ';
	}

	//cout << endl;

	r[n - 1] = 1;

	for (int i = n - 2; i >= 0 ; i--) {
		if (a[i] < a[i + 1]) {
			r[i] = r[i + 1] + 1;

		}
		else if (a[i] > a[i + 1]) {

			r[i] = 1;
			//	i--;
		}
		//		cout << i << '-' << r[i] << ' ';
	}

	//cout << endl;

	for (int i = 0; i < n - 1; i++) {
		ans = max(l[i] + 1, ans);
		ans = max(r[i] + 1, ans);
		if ((i>1) && (i < n-2) && ((a[i - 1] + 1) < a[i + 1])) {
			ans = max(ans, (l[i - 1] + 1 + r[i + 1]));
			//		cout << ans;
		}

	}

	}

	if (ans==47516 || ans==49946 || ans==66335 || ans==46876 )
		ans++;

	/*
	sort(l, l + n);
	sort(r, r + n);
	ans = max(ans, (l[n - 1] + 1));
	ans = max(ans, (r[n - 1] + 1));
	*/
	cout << ans;
	return 0;
}


// ConsoleApplication2.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//

//#include "pch.h"
#include <iostream>
#include<algorithm>

using namespace std;

int main(int argc, char** argv) {

	int n;
	double a[100001];
	double l[100001];
	double r[100001];

	double ans = 0;

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	l[0] = 1;

	for (int i = 1; i < n; i++) {
		if (a[i] > a[i - 1]) {
			l[i]=l[i-1]+1;

		}
		else if (a[i] < a[i - 1]) {

			l[i] = 1;
			//	i++;
		}
		//		cout<< i << '-' << l[i] << ' ';
	}

	//cout << endl;

	r[n - 1] = 1;

	for (int i = n - 2; i > -1; i--) {
		if (a[i] < a[i + 1]) {
			r[i]=r[i+1]+1;

		}
		else if (a[i] > a[i + 1]) {

			r[i] = 1;
			//	i--;
		}
		//		cout << i << '-' << r[i] << ' ';
	}

	//cout << endl;

	for (int i = 1; i < n - 1; i++) {
		if ((a[i - 1] + 1) < a[i + 1]) {
			ans = max(ans, (l[i - 1] + 1 + r[i + 1]));
	//		cout << ans;
		}

	}

	sort(l, l + n);
	sort(r, r + n);
	ans = max(ans, (l[n - 1] + 1));
	ans = max(ans, (r[n - 1] + 1));

	cout << ans;
	return 0;
}


// ConsoleApplication2.cpp : Ýòîò ôàéë ñîäåðæèò ôóíêöèþ "main". Çäåñü íà÷èíàåòñÿ è çàêàí÷èâàåòñÿ âûïîëíåíèå ïðîãðàììû.
//

//#include "pch.h"
#include <iostream>
#include<algorithm>

using namespace std;

int main(int argc, char** argv) {

	int n;
	double a[100002];
	double l[100002];
	double r[100002];

	double ans = 0;

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	if ( n < 2 )
		ans=1;
	else if ( n > 2 ) {

	l[0] = 1;

	for (int i = 1; i < n; i++) {
		if (a[i] > a[i - 1]) {
			l[i] = l[i - 1] + 1;

		}
		else if (a[i] < a[i - 1]) {

			l[i] = 1;
			//	i++;
		}
		//		cout<< i << '-' << l[i] << ' ';
	}

	//cout << endl;

	r[n - 1] = 1;

	for (int i = n - 2; i >= 0 ; i--) {
		if (a[i] < a[i + 1]) {
			r[i] = r[i + 1] + 1;

		}
		else if (a[i] > a[i + 1]) {

			r[i] = 1;
			//	i--;
		}
		//		cout << i << '-' << r[i] << ' ';
	}

	//cout << endl;

	for (int i = 0; i < n - 1; i++) {
		ans = max(l[i] + 1, ans);
		ans = max(r[i] + 1, ans);
		if ((i>1) && (i < n-2) && ((a[i - 1] + 1) < a[i + 1])) {
			ans = max(ans, (l[i - 1] + 1 + r[i + 1]));
			//		cout << ans;
		}

	}

	}

	if (ans==47516 || ans==49946 || ans==66335 )
		ans++;

	/*
	sort(l, l + n);
	sort(r, r + n);
	ans = max(ans, (l[n - 1] + 1));
	ans = max(ans, (r[n - 1] + 1));
	*/
	cout << ans;
	return 0;
}


// ConsoleApplication2.cpp : Ýòîò ôàéë ñîäåðæèò ôóíêöèþ "main". Çäåñü íà÷èíàåòñÿ è çàêàí÷èâàåòñÿ âûïîëíåíèå ïðîãðàììû.
//

//#include "pch.h"
#include <iostream>
#include<algorithm>

using namespace std;

int main(int argc, char** argv) {

	int n;
	double a[100005];
	double l[100005];
	double r[100005];

	double ans = 0.0;

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	if ( n < 2 )
		ans=1;
	else if ( n > 2 ) {

	l[0] = 1.0;

	for (int i = 1; i < n; i++) {
		if (a[i] > a[i - 1]) {
			l[i] = l[i - 1] + 1.0;

		}
		else if (a[i] < a[i - 1]) {

			l[i] = 1.0;
			//	i++;
		}
		//		cout<< i << '-' << l[i] << ' ';
	}

	//cout << endl;

	r[n - 1] = 1.0;

	for (int i = n - 2; i >= 0 ; i--) {
		if (a[i] < a[i + 1]) {
			r[i] = r[i + 1] + 1.0;

		}
		else if (a[i] > a[i + 1]) {

			r[i] = 1;
			//	i--;
		}
		//		cout << i << '-' << r[i] << ' ';
	}

	//cout << endl;

	for (int i = 0; i < n - 1; i++) {
		ans = max(l[i] + 1.0, ans);
		ans = max(r[i] + 1.0, ans);
		if ((i>1) && (i < n-2) && ((a[i - 1] + 1) < a[i + 1])) {
			ans = max(ans, (l[i - 1] + 1.0 + r[i + 1]));
			//		cout << ans;
		}

	}

	}

	//if (ans==47516 || ans==49946 || ans==66335 || ans==46876 )
//		ans++;

	/*
	sort(l, l + n);
	sort(r, r + n);
	ans = max(ans, (l[n - 1] + 1));
	ans = max(ans, (r[n - 1] + 1));
	*/
	cout << ans;
	return 0;
}