import java.util.*; import java.lang.*; import java.io.*; class Main { { long x, x1, x2; long c; int k = 0; x = sc.nextInt(); boolean f = false; while(!f){ x1 = x; x2 = 0; while (x1 > 0) { c = x1%10; x1 /= 10; x2 = x2*10 + c; } if (x == x2) { f = true; break; } else { x += x2; k++; } } } }