Irrational Roots
Time limit1sMemory limit256 MB
Count how many of the n real roots of the given monic integer polynomial are irrational.
- Level
Medium4 of 10
- Topics
- Number theory, Implementation
- Solved
- No attempts yet
Problem
You are given a natural number and integers . Consider the equation
where , all roots of the equation are real, and every root satisfies . The same value may occur as a root more than once.
Write a program that counts how many of the roots are irrational. Roots are counted with multiplicity, so an irrational root that occurs three times counts as 3.
Input
The first line contains . ()
The second line contains in that order, separated by single spaces.
Output
Print the number of irrational roots on one line.