My codechef solution was correct still was not accepted. problem-CHNGIT

my solution was correct but wasnt accepted. wheres the problem?

#include <stdio.h>
int max(int count[]){
int i;int min=count[0];
for(i=0;i<=9;i++){
if(count[i]>min){
min=count[i];
}
}
return min;
}
int main(void) {
// your code goes here
int t,n,A[1000];
scanf("%d",&t);
while(t–){
scanf("%d",&n);
int i,j;
for(i=0;i<n;i++){
scanf("%d",&A[i]);
}
int count[1000]={0};
for(i=0;i<n;i++){
for(j=0;j<=9;j++){
if(A[i]==j){
count[j]++;

            }
            
        }
    }
 int min=n-max(count);
 printf("%d\n",min);
}
return 0;

}

Your code fails for the testcase
1
3
1 2 1
Remember you can’t chose to copy values from A[0] or A[n-1]
Please read the question carefully.