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