package main import ( "fmt" "strconv" ) func main() { var N, v, V, cnt uint64 fmt.Scan(&N) ans := 0 cnt = 1 V = 1000000001 v = V for N >= v { w := []byte(strconv.FormatUint(v, 10)) t := true for i := 0; i < len(w)/2; i++ { if w[i] != w[len(w)-1-i] { t = false break } } if t { ans++ } // log.Println(N, v, t, N >= v) cnt++ v = V * cnt // log.Println(v) } fmt.Println(ans) }