//#include"stdafx.h"
#include<stdio.h>
#include<iostream>
#include<fstream>
#include<string.h>
#include<math.h>
using namespace std;
int main()
{
freopen("test.txt","r",stdin);
//if(fseek(stdut,100L,0))
freopen("out.txt","w",stdout);
int i,a[255],count;
int t;
while(scanf("%d",&t)!=EOF){
count=0;
for(i=0;i<t;i++)
scanf("%d",&a[i]);
for(i=0;i<t;i++){
if(a[i]>a[i+1]);
else{
count+=1;
continue;
}
}
printf("%d\n",count);
}
fclose(stdin);
fclose(stdout);
#include<stdio.h>
#include<iostream>
#include<fstream>
#include<string.h>
#include<math.h>
using namespace std;
int main()
{
freopen("test.txt","r",stdin);
//if(fseek(stdut,100L,0))
freopen("out.txt","w",stdout);
int i,a[255],count;
int t;
while(scanf("%d",&t)!=EOF){
count=0;
for(i=0;i<t;i++)
scanf("%d",&a[i]);
for(i=0;i<t;i++){
if(a[i]>a[i+1]);
else{
count+=1;
continue;
}
}
printf("%d\n",count);
}
fclose(stdin);
fclose(stdout);
}
可能需要去掉for和对数组进行排序