ural 1289. One Way Ticket

1289. One Way Ticket

Time limit: 1.0 second
Memory limit: 64 MB
A crowed of volunteers dressed in the star striped overalls have filled the starport. There starcraft leaves to the thorium mines of Haron. Their job will be hard and dangerous. Will many of them return home?
This question has an exact answer. Each of the volunteers has a ticket to the starcraft. There signed a compartment number where he is to fly. The starcraft is not passenger, it departs to Haron once a month full of the volunteers and returns back loaded with thorium. This precious metal can be loaded not in all of the compartments. In such a compartments volunteers can return home. All the others are to stay at Haron... Forever.
The compartments are numbered. The numbers of the unfit compartments (and only their numbers) are so that the digit root of the first half of the number equals to the digit root of the second half. To calculate the digit root of a number one is to summarize the digits of the number; if the result is greater or equal than 10, then the digits of the result are to be summarized again; and so on until one gets a number from 0 to 9.
How many volunteers will return home?

Input

Even integer number N ≤ 200000 – an amount of digits used to number the compartments. There are exactly 10N compartments numbered from 0 to 10N-1 with the leading zeros.

Output

The number of compartments free of thorium on the way home.

Sample

inputoutput
2
10
Problem Author: Leonid Volkov
Problem Source: USU Personal Contest 2004
posted @ 2015-10-26 20:47  yanzx6  阅读(204)  评论(0编辑  收藏  举报