import std.stdio, std.string, std.conv, std.range, std.array, std.algorithm; import std.uni, std.math, std.container, std.typecons, std.typetuple; import core.bitop, std.datetime; void main(){ auto N = readln.chomp.to!ulong; ulong a = 10^^9 + 1; ulong k = 1; int cnt; while(k*a <= N){ if(k.to!string == k.to!(char[]).reverse.to!string){ ++cnt; } ++k; } writeln(cnt); } void readVars(T...)(auto ref T args){ auto line = readln.split; foreach(ref arg ; args){ arg = line.front.to!(typeof(arg)); line.popFront; } if(!line.empty){ throw new Exception("args num < input num"); } }