import java.util.Scanner; public class Kaibun { public static void main(String[] args) { Scanner s = new Scanner(System.in); int count = 0; long t = (long)Math.pow(10, 9) +1 , N = s.nextLong(); s.close(); for(long i = 1;i * t <= N ;i++){ String str = String.valueOf(i*t); StringBuffer str2 = new StringBuffer(str); if(str.contentEquals(str2.reverse())){ count++; } } System.out.println(count); } }