Help me in solving AOCC16 problem

My issue

My code

// Update the code below to solve the problem

#include <bits/stdc++.h>
using namespace std;

int main() 
{
	int t;
    cin >> t;
	
	while(t--)
	{
	    int N;
	    cin >> N;
	    int A[N];
	    for(int i=0; i < N; i++)
	    {
	        cin >> A[i];
	    }
	    sort(A, A+N);
	    for(int i = 0; i < N; i++){
	        if(A[i]==A[i+1]){
	            continue;
	        }
	        cout << A[i] << endl;
	    }
	    
	}
}

Learning course: Solve Programming problems using C++
Problem Link: CodeChef: Practical coding for everyone

@ujwalgulhane31
ATQ u cannot change the sequence of numbers given to you.
So, sorting will not help in this case.
you just need to check if the next number is equal . if it’s true then increase the counter variable .
at the end just print N - count .

I have pasted my correct code below .

hope this helps!!

include <bits/stdc++.h>
using namespace std;

int main()
{
int t;
cin >> t;

while(t--)
{ int count=0;
    int N;
    cin >> N;
    int A[N];
    for(int i=0; i < N; i++)
    { 
        cin >> A[i];
        
    }
  for(int i=0;i<N;i++)
  { int j=i+1;
      if(A[i]==A[j])
      {count++;
        
      }
     
  }
  std::cout << N-count << std::endl;
}

}