Apartment Rental
Time limit1sMemory limit256 MB
Count how many given numbers up to 2^31-1 cannot be written as 2xy + x + y with positive integers x and y.
- Level
Medium7 of 10
- Topics
- Number theory, Math, Binary search, Sorting
- Solved
- No attempts yet
Problem
Donggyu Real Estate rents out apartments. The area of an apartment's room is given by , where and are positive integers.
The Donggyu Real Estate catalog lists apartment areas in ascending order. However, some of these values are impossible sizes that cannot be produced by the formula above. If you say you want to rent an apartment of such a size, Donggyu shouts "Wrong!" and walks off with only the commission.
Given the apartment areas written in the catalog, write a program that counts how many of them are impossible sizes.
Input
The first line contains the number of apartment areas . Each of the next lines contains one area, in the order listed in the catalog.
is at most , and each area is a positive integer at most .
Output
Print the number of impossible apartment areas on the first line.