Language: Java

import java.util.*;
 
public class Main {
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    ArrayList<Integer> aList = new ArrayList<Integer>();
    for (int i=0; i<n; i++) {
      aList.add(sc.nextInt());
    }
    
    int cnt = n;
    Arrays.sort(aList);
    HashMap<int, boolean> map = new HashMap<int, boolean>();
    
    for (int i=0; i<n; i++) {
      int ai = aList.get(i);
      if (map.contains(ai)) {
        if (map.get(ai)) {
          c--;
        }
        break;
      } else {
        map.put(ai, false);
        for (int j=0; j<n; j++) {
          int aj = aList.get(j);
          if ( i!=j && (ai%aj==0) ) {
            cnt--;
            map.put(ai, true);
            break;
          }
        }
      }
    }
    System.out.println(cnt);
  }
}


Compiler output:
Main.java:14: error: no suitable method found for sort(ArrayList<Integer>)
    Arrays.sort(aList);
          ^
    method Arrays.sort(int[]) is not applicable
      (argument mismatch; ArrayList<Integer> cannot be converted to int[])
    method Arrays.sort(long[]) is not applicable
      (argument mismatch; ArrayList<Integer> cannot be converted to long[])
    method Arrays.sort(short[]) is not applicable
      (argument mismatch; ArrayList<Integer> cannot be converted to short[])
    method Arrays.sort(char[]) is not applicable
      (argument mismatch; ArrayList<Integer> cannot be converted to char[])
    method Arrays.sort(byte[]) is not applicable
      (argument mismatch; ArrayList<Integer> cannot be converted to byte[])
    method Arrays.sort(float[]) is not applicable
      (argument mismatch; ArrayList<Integer> cannot be converted to float[])
    method Arrays.sort(double[]) is not applicable
      (argument mismatch; ArrayList<Integer> cannot be converted to double[])
    method Arrays.sort(Object[]) is not applicable
      (argument mismatch; ArrayList<Integer> cannot be converted to Object[])
    method Arrays.<T#1>sort(T#1[],Comparator<? super T#1>) is not applicable
      (cannot infer type-variable(s) T#1
        (actual and formal argument lists differ in length))
    method Arrays.<T#2>sort(T#2[],int,int,Comparator<? super T#2>) is not applicable
      (cannot infer type-variable(s) T#2
        (actual and formal argument lists differ in length))
  where T#1,T#2 are type-variables:
    T#1 extends Object declared in method <T#1>sort(T#1[],Comparator<? super T#1>)
    T#2 extends Object declared in method <T#2>sort(T#2[],int,int,Comparator<? super T#2>)
Main.java:15: error: unexpected type
    HashMap<int, boolean> map = new HashMap<int, boolean>();
            ^
  required: reference
  found:    int
Main.java:15: error: unexpected type
    HashMap<int, boolean> map = new HashMap<int, boolean>();
                 ^
  required: reference
  found:    boolean
Main.java:15: error: unexpected type
    HashMap<int, boolean> map = new HashMap<int, boolean>();
                                            ^
  required: reference
  found:    int
Main.java:15: error: unexpected type
    HashMap<int, boolean> map = new HashMap<int, boolean>();
                                                 ^
  required: reference
  found:    boolean
Main.java:21: error: cannot find symbol
          c--;
          ^
  symbol:   variable c
  location: class Main
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
6 errors