COOK98B-MAKEPERM WA

Pls can anyone tell me why my solution is being rejected by codechef while it works fine in my compiler
question link-https://www.codechef.com/COOK98B/problems/MAKPERM
solution

#include
#include
using namespace std;

int main()
{ int t;
cin>>t;
while(t–)
{
long long int n;
cin>>n;
long long int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
sort(a,a+n);
int ctr=0,s=1;

for(int i=0;i<n;i++)
{	if (a[i]==a[i+1])
	{	ctr++;}	
	else if(a[i]!=s&&a[i]>n)
		{ctr++;s++;}
	else s++;
}
cout<<ctr;}

//for(int i=0;i<n;i++)
// cout<<a[i];
return 0;}

//