#P10900. [蓝桥杯 2024 省 C] 数字诗意
[蓝桥杯 2024 省 C] 数字诗意
Problem Description
In a poet’s eyes, numbers are the rhythm of life and a way to express poetry.
Xiao Lan, a top modern poet and mathematician, is known as the “mathematical poet”. He is good at blending cold numbers with abstract poetic meaning, and presenting the beauty of mathematics on paper with elegant words.
One day, Xiao Lan sits quietly at his desk. In front of him are numbers, in order: , shining brightly. Xiao Lan realizes that if a number can be written as the sum of several (at least two) consecutive positive integers, then it contains poetic meaning. For example, the number contains poetic meaning because it can be written as . But lacks poetic meaning because it cannot be expressed as a sum of consecutive positive integers.
Xiao Lan wants all the numbers in front of him to contain poetic meaning, so he decides to delete some of these numbers. How many numbers does Xiao Lan need to delete so that all remaining numbers contain poetic meaning?
Input Format
The first line contains an integer , representing the number of displayed numbers.
The second line contains integers , separated by a single space, representing the displayed numbers.
Output Format
Output a single line containing an integer, representing the number of numbers Xiao Lan needs to delete so that all remaining numbers contain poetic meaning.
3
3 6 8
1
Hint
Sample Explanation
In the sample, the number can be written as , and the number can be written as . The number cannot be written as a sum of consecutive positive integers, so the number of deleted numbers is .
Constraints
For of the testdata, , .
For all testdata, , .
Translated by ChatGPT 5