Help me in solving CFRTEST problem

My issue

why my code printing 2 for 2nd testcase also

My code

#include<stdio.h>
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int n,i,j;
        scanf("%d",&n);
        int a[n];
        for( i=0;i<n;i++)
        {
            scanf("%d",&a[i]);
        }
        int count=0;
        for(j=i+1;j<n;j++)
        {
            if(a[i]==a[j])
            {
                count++;
                break;
            }
        }
        printf("%d\n",n-count);
        
    }
}

Learning course: Arrays, Strings & Sorting
Problem Link: Devu and friendship testing Practice Problem in Arrays, Strings & Sorting - CodeChef

apart from the distinct value you have to consider common value also. I mean lets say the 2,3,5,7,5. here you can give b’day party in the distinct dates 2,3,7.
Now In day 5, two friends want b’day party so you have to choose one of a friend to give him a party and subsecuently you loose one friend. so total ans will be distinct value+1 common value. i.e 2,3,7,5 total 4