#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 200000+100;

int n,tmp;
int a[maxn];

int main()
{
	scanf("%d",&n);
	for(int i = 1;i <= n;i++)
	{
		scanf("%d",&tmp);
		a[tmp] = i;
	}
	int ans = 1;
	int k = 1;
	for(int i = 1;i <= n-1;i++)
	{
		k = 1;
		while(a[i] < a[i+1])
		{
			i++;
			k++;
		}
		ans = max(ans,k);
	}
	printf("%d\n",ans);
	return 0;
} 