Irrational Roots

Count how many of the n real roots of the given monic integer polynomial are irrational.

Medium4Number theoryImplementationNo attempts yetTime limit1sMemory limit256 MB

Problem

You are given a natural number nn and integers cn1,cn2,,c1,c0c_{n-1}, c_{n-2}, \dots, c_1, c_0. Consider the equation

xn+cn1xn1+cn2xn2++c1x+c0=0x^n + c_{n-1}x^{n-1} + c_{n-2}x^{n-2} + \dots + c_1x + c_0 = 0

where c00c_0 \neq 0, all nn roots of the equation are real, and every root rr satisfies 10r10-10 \le r \le 10. The same value may occur as a root more than once.

Write a program that counts how many of the nn roots are irrational. Roots are counted with multiplicity, so an irrational root that occurs three times counts as 3.

Input

The first line contains nn. (1n81 \le n \le 8)

The second line contains cn1,cn2,,c1,c0c_{n-1}, c_{n-2}, \dots, c_1, c_0 in that order, separated by single spaces.

Output

Print the number of irrational roots on one line.