Help me in solving LARGESTK problem

My issue

where is my code is wrong

My code

import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
      Scanner sc = new Scanner(System.in);
      int t = sc.nextInt();
      for(int i =0;i<t;i++){
      int n = sc.nextInt();
      int[] a = new int[n];
          for(int j =0;j<n;j++){                                                            a[j] = sc.nextInt();
         }   int count = 0;
             for(int k=0;k<n;k++){
                 int y;
                 for(y=0;y<k;y++){
                     if(a[k]==a[y]){
                        break;  
                       } 
                      }   if(k==y){
                          count++;
                       }
                     }       
                     int temp = (n/count);
                     int maxsub = (temp*count);
                      System.out.println(maxsub); 
	}                   
  }
}

Problem Link: Largest K Practice Coding Problem