#include <stdio.h>
#define M 1010000
int a [M],d [M];
int main (void)
{
// freopen ("input29.txt","r",stdin);
// freopen ("output.txt","w",stdout);
int n,cnt = 1,max = 0;
scanf ("%d",&n);
for (int i = 1; i <= n; i++)
{
scanf ("%d",&a[i]);
d [a[i]] = i;
}
for (i = 1; i <= n; i++)
{
if (d [i] < d[i + 1])
cnt++;
else
cnt = 1;
if (cnt > max)
max = cnt;
}
printf ("%d",n - max);
return 0;
}
Compilation message
jul.cpp: In function 'int main()':
jul.cpp:22: error: name lookup of 'i' changed for new ISO 'for' scoping
jul.cpp:16: error: using obsolete binding at 'i'