1832: 【CSP函数】回文数个数▅

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:6 Solved:5

Description

一个正整数,正读和反读都相同的数为回文数。

例如 lns="http://www.w3.org/1998/Math/MathML">22 , lns="http://www.w3.org/1998/Math/MathML">131 , lns="http://www.w3.org/1998/Math/MathML">2442 , lns="http://www.w3.org/1998/Math/MathML">37073 , lns="http://www.w3.org/1998/Math/MathML">6 ,lns="http://www.w3.org/1998/Math/MathML"> 所有 lns="http://www.w3.org/1998/Math/MathML">1 位数都是回文数。

给出一个正整数 lns="http://www.w3.org/1998/Math/MathML">n ( lns="http://www.w3.org/1998/Math/MathML">1n10000 ),求出 lns="http://www.w3.org/1998/Math/MathML">1,2,,n 之中(包括 lns="http://www.w3.org/1998/Math/MathML">1 和 lns="http://www.w3.org/1998/Math/MathML">n )的回文数的个数。

Input

任意给定一个正整数 lns="http://www.w3.org/1998/Math/MathML">n  lns="http://www.w3.org/1998/Math/MathML">0<n10000 

Output

一个正整数,表示[ lns="http://www.w3.org/1998/Math/MathML">1,n ]之间的回文数的个数。

Sample Input Copy

325

Sample Output Copy

41