如图:
#include<stdio.h>
int main()
{
int a[10000],n;
scanf("%d",&n);
int i;
for (i=0;i<n;i++)
{
scanf("%d",a[i]);
}
int t,m;
for (i=0;i<n;i++)
{
if (a[i]>a[i+1])
{
t = a[i];
a[i] = a[i+1];
a[i+1] = t;
}
}
for (int j=0;j<n;j++)
{
if (a[j+1] - a[j] == 1)
{
m=0;
m++;
}
else break;
}
printf("%d",m);
return 0;
}