Language: C++

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

public class Main {
	
	public static int check(int n , Set<Integer> set) {
		for(int i = 2; i*i <= n; i++) {
			if(n%i == 0) {
				if(n/i == i) {
					if(set.contains(i)) return 0; 
				}
				else {
					if(set.contains(i) || set.contains(n/i)) return 0; 
				}
			}
		}
		return 1; 
	}
	public static void solve(InputReader in) {
		int n = in.readInt(); 
		int a[] = new int[n]; 
		
		for(int i = 0; i<n; i++)
			a[i] = in.readInt(); 
		
		Set<Integer> set = new HashSet<>(); 
		HashMap<Integer, Integer> map = new HashMap<>(); 
		
		for(int i : a) {
			set.add(i); 
			map.put(i, map.getOrDefault(i, 0) + 1); 
		}
		if(map.get(1) != null) {
			int k = map.get(1); 
			if(k == 1) {
				System.out.println(1); 
				return; 
			}
			else {
				System.out.println(0); 
				return; 
			}
		}
		
		int count = 0; 
		
		for(int j = 0; j<n; j++) {
			if(check(a[j] , set) == 1 && map.get(a[j]) == 1) count++; 
		}
		
		System.out.println(count); 
	}
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in); 
		int t = 1; 
		while(t-- > 0) {
			solve(in); 
		}
	}
}

class InputReader{
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	 public InputReader(InputStream stream) {
		this.stream = stream;
	}

     public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

     public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

     public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

     public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
     public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}
     
     public String next() {
		return readString();
	}
    
     public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.io.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
    4 | public class Main {
      | ^~~~~~
a.cc:63:16: error: expected ':' before 'InputStream'
   63 |         private InputStream stream;
      |                ^~~~~~~~~~~~
      |                :
a.cc:63:17: error: 'InputStream' does not name a type
   63 |         private InputStream stream;
      |                 ^~~~~~~~~~~
a.cc:64:16: error: expected ':' before 'byte'
   64 |         private byte[] buf = new byte[1024];
      |                ^~~~~
      |                :
a.cc:64:17: error: 'byte' does not name a type
   64 |         private byte[] buf = new byte[1024];
      |                 ^~~~
a.cc:65:16: error: expected ':' before 'int'
   65 |         private int curChar;
      |                ^~~~
      |                :
a.cc:66:16: error: expected ':' before 'int'
   66 |         private int numChars;
      |                ^~~~
      |                :
a.cc:67:16: error: expected ':' before 'SpaceCharFilter'
   67 |         private SpaceCharFilter filter;
      |                ^~~~~~~~~~~~~~~~
      |                :
a.cc:67:17: error: 'SpaceCharFilter' does not name a type
   67 |         private SpaceCharFilter filter;
      |                 ^~~~~~~~~~~~~~~
a.cc:69:16: error: expected ':' before 'InputReader'
   69 |          public InputReader(InputStream stream) {
      |                ^~~~~~~~~~~~
      |                :
a.cc:69:40: error: expected ')' before 'stream'
   69 |          public InputReader(InputStream stream) {
      |                            ~           ^~~~~~~
      |                                        )
a.cc:73:12: error: expected ':' before 'int'
   73 |      public int read() {
      |            ^~~~
      |            :
a.cc:89:12: error: expected ':' before 'int'
   89 |      public int readInt() {
      |            ^~~~
      |            :
a.cc:109:12: error: expected ':' before 'String'
  109 |      public String readString() {
      |            ^~~~~~~
      |            :
a.cc:109:13: error: 'String' does not name a type
  109 |      public String readString() {
      |             ^~~~~~
a.cc:121:12: error: expected ':' before 'long'
  121 |      public long readLong() {
      |            ^~~~~
      |            :
a.cc:143:12: error: expected ':' before 'boolean'
  143 |      public boolean isSpaceChar(int c) {
      |            ^~~~~~~~
      |            :
a.cc:143:13: error: 'boolean' does not name a type; did you mean 'bool'?
  143 |      public boolean isSpaceChar(int c) {
      |             ^~~~~~~
      |             bool
a.cc:149:12: error: expected ':' before 'String'
  149 |      public String next() {
      |            ^~~~~~~
      |            :
a.cc:149:13: error: 'String' does not name a type
  149 |      public String next() {
      |             ^~~~~~
a.cc:153:12: error: expected ':' before 'interface'
  153 |      public interface SpaceCharFilter {
      |            ^~~~~~~~~~
      |            :
a.cc:153:13: error: 'interface' does not name a type
  153 |      public interface SpaceCharFilter {
      |             ^~~~~~~~~
a.cc:156:2: error: expected ';' after class definition
  156 | }
      |  ^
      |  ;
a.cc: In member function 'int InputReader::read()':
a.cc:75:35: error: expected type-specifier before 'InputMismatchException'
   75 |                         throw new InputMismatchException();
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
a.cc:79:44: error: 'stream' was not declared in this scope
   79 |                                 numChars = stream.read(buf);
      |                                            ^~~~~~
a.cc:79:56: error: 'buf' was not declared in this scope
   79 |                                 numChars = stream.read(buf);
      |                                                        ^~~
a.cc:80:34: error: 'IOException' does not name a type
   80 |                         } catch (IOException e) {
      |                                  ^~~~~~~~~~~
a.cc:81:43: error: expected type-specifier before 'InputMismatchException'
   81 |                                 throw new InputMismatchException();
      |                                           ^~~~~~~~~~~~~~~~~~~~~~
a.cc:86:24: error: 'buf' was not declared in this scope
   86 |                 return buf[curChar++];
      |                        ^~~
a.cc: In member function 'int InputReader::readInt()':
a.cc:91:24: error: 'isSpaceChar' was not declared in this scope
   91 |                 while (isSpaceChar(c))
      |                        ^~~~~~~~~~~
a.cc:101:43: error: expected type-specifier before 'InputMismatchException'
  101 |                                 throw new InputMismatchException();
      |                                           ^~~~~~~~~~~~~~~~~~~~~~
a.cc:105:27: error: 'isSpaceChar' was not declared in this scope
  105 |                 } while (!isSpaceChar(c));
      |                           ^~~~~~~~~~~
a.cc: In member function 'long int InputReader::readLong()':
a.cc:123:24: error: 'isSpaceChar' was not declared in this scope
  123 |                 while (isSpaceChar(c)) {
      |                        ^~~~~~~~~~~
a.cc:134:43: error: expected type-specifier before 'InputMismatchException'
  134 |                                 throw new InputMismatchException();
      |                                           ^~~~~~~~~~~~~~~~~~~~~~
a.cc:139:27: error: 'isSpaceChar' was not declared in this scope
  139 |                 } while (!isSpaceChar(c));
      |                           ^~~~~~~~~~~