Problem: Misha decided to help Pasha and Akim be friends again. He had a cunning plan — to destroy all the laughy mushrooms. He knows that the laughy mushrooms can easily burst when they laugh. Mushrooms grow on the lawns. There are a[t] mushrooms on the t-th lawn.

Misha knows that the lawns where the mushrooms grow have a unique ability. A lawn (say, i) can transfer laugh to other lawn (say, j) if there exists an integer (say, b) such, that some permutation of numbers a[i], a[j] and b is a beautiful triple (i ≠ j). A beautiful triple is such three pairwise coprime numbers x, y, z, which satisfy the following condition: x2 + y2 = z2.

Misha wants to know on which minimal number of lawns he should laugh for all the laughy mushrooms to burst.

Input

The first line contains one integer n (1 ≤ n ≤ 106) which is the number of lawns. The next line contains n integers ai which are the number of mushrooms on the i-lawn (1 ≤ ai ≤ 107). All the numbers are different.

Output

Print a single number — the minimal number of lawns on which Misha should laugh for all the mushrooms to burst.

Examples

Input

1
2


Output

1


Input

2
1 2


Output

2


Input

2
3 5


Output

1

Solution (in JAVA):

Solution:
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	final static int M = 10000005;
	static boolean[] hash = new boolean[2 * M];
	static int[] parent = new int[2 * M];

	static int find(int n) {
		if (parent[n] == n) {
			return n;
		} else {
			return parent[n] = find(parent[n]);
		}
	}

	static void union(int a, int b) {
		int x = find(a);
		int y = find(b);
		parent[x] = y;
	}

	static long getGCD(long a, long b) {
		if (b == 0) {
			return a;
		} else {
			return getGCD(b, a % b);
		}
	}

	static boolean testGCD(long x, long y, long z) {
		if (getGCD(x, y) == 1 && getGCD(x, z) == 1 && getGCD(y, z) == 1) {
			return true;
		} else {
			return false;
		}
	}

	static void doIt(int maxZ) {
		int maxX = (int) (maxZ * 1.41) + 10;
		for (int i = 0; i < 2 * M; i++) {
			parent[i] = i;
		}
		for (int a = 1; a * a < maxX; a++) {
			for (int b = 1; b < a; b++) {
				long x = 1L * a * a - b * b;
				long y = 2L * a * b;
				long z = 1L * a * a + b * b;
				if (z > 2 * M) {
					break;
				}

				if (hash[(int) x] && hash[(int) y] && testGCD(x, y, z)) {
					union((int) x, (int) y);
				}

				if (hash[(int) x] && hash[(int) z] && testGCD(x, y, z)) {
					union((int) x, (int) z);
				}

				if (hash[(int) z] && hash[(int) y] && testGCD(x, y, z)) {
					union((int) z, (int) y);
				}
			}
		}
	}

	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int n = cin.nextInt();
		int maxZ = -1;
		Arrays.fill(hash, false);
		for (int i = 0; i < n; i++) {
			int in = cin.nextInt();
			hash[in] = true;
			maxZ = Math.max(maxZ, in);
		}
		doIt(maxZ);
		int cnt = 0;
		for (int i = 0; i < 2 * M; i++) {
			if (parent[i] == i && hash[i]) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}

}