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 = 1l;i * t <= N ;i++){ String str = String.valueOf(i*t); StringBuffer str2 = new StringBuffer(str); if(i * t == Integer.parseInt(str2.reverse().toString())){ count++; } } System.out.println(count); } }