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.io.*;
import java.util.*;

public class D{
        int[] p;
        int[] rank;
        final static  int maxn = 10000002;
        void solve()throws Exception
        {
            int n = nextInt();
            int[]ind=new int[maxn];
            rank = new int[n];
            Arrays.fill(ind,-1);
            p = new int[n];
            for (int i = 0; i < n; i++)
            {
                ind[nextInt()] = i;
                p[i]=i;
            }
            for (long x = 1; x < maxn; x++)
                for (long y = x + 1; Math.max(2 * x * y, y * y - x * x) < maxn; y+=2)
                    if (gcd(x, y) == 1)
                    {
                        long x1 = y * y - x * x;
                        long y1 = 2 * x * y;
                        long z1 = x * x + y * y;
                        if (x1 < maxn && y1 < maxn )
                        {
                            union(ind[(int)x1], ind[(int)y1]);
                        }
                        if (x1 < maxn && z1 < maxn)
                        {
                            union(ind[(int)x1], ind[(int)z1]);
                        }
                        if (z1 < maxn && y1 < maxn)
                        {
                            union(ind[(int)z1], ind[(int)y1]);
                        }
                    }
            int res = 0;
            for(int i=0;i<n;i++)
                if(find(i)==i)
                    res++;
            System.out.println(res);
        }

        private void union(long x, long y)
        {
            if(x==-1 || y==-1)
                return;
            int px=find((int)x);
            int py=find((int)y);
            if (px != py)
            {
                link(px, py);
            }
        }

        private void link(int x, int y)
        {
            if (rank[x] > rank[y])
            {
                p[y] = x;
            }
            else
                p[x] = y;
            if (rank[x] == rank[y])
                rank[y]++;
        }

        private int find(int x)
        {
            if (p[x] != x)
                p[x] = find(p[x]);
            return p[x];
        }

        private long gcd(long x, long y)
        {
            if (y == 0)
                return x;
            return gcd(y, x % y);
        }

	BufferedReader reader;
	PrintWriter writer;
	StringTokenizer stk;
	void run()throws Exception
	{
		reader=new BufferedReader(new InputStreamReader(System.in));
		stk=null;
		writer=new PrintWriter(System.out);
		solve();
		//reader.close();
		//writer.close();
	}
	int nextInt()throws Exception
	{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws Exception
	{	
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws Exception
	{		
		return Double.parseDouble(nextToken());
	}
	String nextString()throws Exception
	{
		return nextToken();
	}
	String nextLine()throws Exception
	{
		return reader.readLine();
	}
	String nextToken()throws Exception
	{
		if(stk==null || !stk.hasMoreTokens())
		{
			stk=new StringTokenizer(nextLine());
			return nextToken();
		}
		return stk.nextToken();
	}
	
	public static void main(String[]a) throws Exception
	{	
		new D().run();

	}
	
}