import java.util.*;
public class Main{

	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		int min = 12;
		long n = scan.nextLong();
		if(n<10){System.out.println(1);}
		else{
		int k = (int)Math.sqrt(n);
		for(long i=1; i<k+1; i++){
			if(n%i==0){
				long j = n/i;
				int keta = f(i,j);
				if(keta<min){
					min = keta;
				}
			}
		}
		System.out.println(min);}
	}

	//F(A,B)を求めるメソッド
	public static int f(long a,long b){
		int aketa = 0;
		int bketa = 0;
		int cketa = 0;
		for(int i=1; i<11; i++){
			long xx = (long)Math.pow(10,i);
			long x = a/xx;
			long y = b/xx;
			if(x>=1&&x<10){
				aketa = i+1;
			}
			if(y>=1&&y<10){
				bketa = i+1;
			}
		}
		cketa = Math.max(aketa,bketa);
		return cketa;
	}
} import java.util.*; util.* java public class Main{

	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		int min = 12;
		long n = scan.nextLong();
		if(n<10){System.out.println(1);}
		else{
		int k = (int)Math.sqrt(n);
		for(long i=1; i<k+1; i++){
			if(n%i==0){
				long j = n/i;
				int keta = f(i,j);
				if(keta<min){
					min = keta;
				}
			}
		}
		System.out.println(min);}
	}

	//F(A,B)を求めるメソッド
	public static int f(long a,long b){
		int aketa = 0;
		int bketa = 0;
		int cketa = 0;
		for(int i=1; i<11; i++){
			long xx = (long)Math.pow(10,i);
			long x = a/xx;
			long y = b/xx;
			if(x>=1&&x<10){
				aketa = i+1;
			}
			if(y>=1&&y<10){
				bketa = i+1;
			}
		}
		cketa = Math.max(aketa,bketa);
		return cketa;
	}
} Main public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		int min = 12;
		long n = scan.nextLong();
		if(n<10){System.out.println(1);}
		else{
		int k = (int)Math.sqrt(n);
		for(long i=1; i<k+1; i++){
			if(n%i==0){
				long j = n/i;
				int keta = f(i,j);
				if(keta<min){
					min = keta;
				}
			}
		}
		System.out.println(min);}
	} main {
		Scanner scan = new Scanner(System.in);
		int min = 12;
		long n = scan.nextLong();
		if(n<10){System.out.println(1);}
		else{
		int k = (int)Math.sqrt(n);
		for(long i=1; i<k+1; i++){
			if(n%i==0){
				long j = n/i;
				int keta = f(i,j);
				if(keta<min){
					min = keta;
				}
			}
		}
		System.out.println(min);}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int min = 12; min 12 long n = scan.nextLong(); n scan.nextLong() scan.nextLong scan if(n<10){System.out.println(1);}
		else{
		int k = (int)Math.sqrt(n);
		for(long i=1; i<k+1; i++){
			if(n%i==0){
				long j = n/i;
				int keta = f(i,j);
				if(keta<min){
					min = keta;
				}
			}
		}
		System.out.println(min);} n<10 n 10 {System.out.println(1);} System.out.println(1) System.out.println System.out System System.out 1 {
		int k = (int)Math.sqrt(n);
		for(long i=1; i<k+1; i++){
			if(n%i==0){
				long j = n/i;
				int keta = f(i,j);
				if(keta<min){
					min = keta;
				}
			}
		}
		System.out.println(min);} int k = (int)Math.sqrt(n); k (int)Math.sqrt(n) Math.sqrt Math n for(long i=1; i<k+1; i++){
			if(n%i==0){
				long j = n/i;
				int keta = f(i,j);
				if(keta<min){
					min = keta;
				}
			}
		} long i=1; long i=1; i 1 i<k+1 i k+1 k 1 i++ i++ i {
			if(n%i==0){
				long j = n/i;
				int keta = f(i,j);
				if(keta<min){
					min = keta;
				}
			}
		} {
			if(n%i==0){
				long j = n/i;
				int keta = f(i,j);
				if(keta<min){
					min = keta;
				}
			}
		} if(n%i==0){
				long j = n/i;
				int keta = f(i,j);
				if(keta<min){
					min = keta;
				}
			} n%i==0 n%i n i 0 {
				long j = n/i;
				int keta = f(i,j);
				if(keta<min){
					min = keta;
				}
			} long j = n/i; j n/i n i int keta = f(i,j); keta f(i,j) f i j if(keta<min){
					min = keta;
				} keta<min keta min {
					min = keta;
				} min = keta min keta System.out.println(min) System.out.println System.out System System.out min String args[] args //F(A,B)を求めるメソッド
	public static int f(long a,long b){
		int aketa = 0;
		int bketa = 0;
		int cketa = 0;
		for(int i=1; i<11; i++){
			long xx = (long)Math.pow(10,i);
			long x = a/xx;
			long y = b/xx;
			if(x>=1&&x<10){
				aketa = i+1;
			}
			if(y>=1&&y<10){
				bketa = i+1;
			}
		}
		cketa = Math.max(aketa,bketa);
		return cketa;
	} f {
		int aketa = 0;
		int bketa = 0;
		int cketa = 0;
		for(int i=1; i<11; i++){
			long xx = (long)Math.pow(10,i);
			long x = a/xx;
			long y = b/xx;
			if(x>=1&&x<10){
				aketa = i+1;
			}
			if(y>=1&&y<10){
				bketa = i+1;
			}
		}
		cketa = Math.max(aketa,bketa);
		return cketa;
	} int aketa = 0; aketa 0 int bketa = 0; bketa 0 int cketa = 0; cketa 0 for(int i=1; i<11; i++){
			long xx = (long)Math.pow(10,i);
			long x = a/xx;
			long y = b/xx;
			if(x>=1&&x<10){
				aketa = i+1;
			}
			if(y>=1&&y<10){
				bketa = i+1;
			}
		} int i=1; int i=1; i 1 i<11 i 11 i++ i++ i {
			long xx = (long)Math.pow(10,i);
			long x = a/xx;
			long y = b/xx;
			if(x>=1&&x<10){
				aketa = i+1;
			}
			if(y>=1&&y<10){
				bketa = i+1;
			}
		} {
			long xx = (long)Math.pow(10,i);
			long x = a/xx;
			long y = b/xx;
			if(x>=1&&x<10){
				aketa = i+1;
			}
			if(y>=1&&y<10){
				bketa = i+1;
			}
		} long xx = (long)Math.pow(10,i); xx (long)Math.pow(10,i) Math.pow Math 10 i long x = a/xx; x a/xx a xx long y = b/xx; y b/xx b xx if(x>=1&&x<10){
				aketa = i+1;
			} x>=1&&x<10 x>=1 x 1 x<10 x 10 {
				aketa = i+1;
			} aketa = i+1 aketa i+1 i 1 if(y>=1&&y<10){
				bketa = i+1;
			} y>=1&&y<10 y>=1 y 1 y<10 y 10 {
				bketa = i+1;
			} bketa = i+1 bketa i+1 i 1 cketa = Math.max(aketa,bketa) cketa Math.max(aketa,bketa) Math.max Math aketa bketa return cketa; cketa long a a long b b public class Main{

	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		int min = 12;
		long n = scan.nextLong();
		if(n<10){System.out.println(1);}
		else{
		int k = (int)Math.sqrt(n);
		for(long i=1; i<k+1; i++){
			if(n%i==0){
				long j = n/i;
				int keta = f(i,j);
				if(keta<min){
					min = keta;
				}
			}
		}
		System.out.println(min);}
	}

	//F(A,B)を求めるメソッド
	public static int f(long a,long b){
		int aketa = 0;
		int bketa = 0;
		int cketa = 0;
		for(int i=1; i<11; i++){
			long xx = (long)Math.pow(10,i);
			long x = a/xx;
			long y = b/xx;
			if(x>=1&&x<10){
				aketa = i+1;
			}
			if(y>=1&&y<10){
				bketa = i+1;
			}
		}
		cketa = Math.max(aketa,bketa);
		return cketa;
	}
} public class Main{

	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		int min = 12;
		long n = scan.nextLong();
		if(n<10){System.out.println(1);}
		else{
		int k = (int)Math.sqrt(n);
		for(long i=1; i<k+1; i++){
			if(n%i==0){
				long j = n/i;
				int keta = f(i,j);
				if(keta<min){
					min = keta;
				}
			}
		}
		System.out.println(min);}
	}

	//F(A,B)を求めるメソッド
	public static int f(long a,long b){
		int aketa = 0;
		int bketa = 0;
		int cketa = 0;
		for(int i=1; i<11; i++){
			long xx = (long)Math.pow(10,i);
			long x = a/xx;
			long y = b/xx;
			if(x>=1&&x<10){
				aketa = i+1;
			}
			if(y>=1&&y<10){
				bketa = i+1;
			}
		}
		cketa = Math.max(aketa,bketa);
		return cketa;
	}
} Main
import java.util.*;
public class Main{

	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		int min = 12;
		long n = scan.nextLong();
		if(n<10){System.out.println(1);}
		else{
		int k = (int)Math.sqrt(n);
		for(long i=1; i<k+1; i++){
			if(n%i==0){
				long j = n/i;
				int keta = f(i,j);
				if(keta<min){
					min = keta;
				}
			}
		}
		System.out.println(min);}
	}

	//F(A,B)を求めるメソッド
	public static int f(long a,long b){
		int aketa = 0;
		int bketa = 0;
		int cketa = 0;
		for(int i=1; i<11; i++){
			long xx = (long)Math.pow(10,i);
			long x = a/xx;
			long y = b/xx;
			if(x>=1&&x<10){
				aketa = i+1;
			}
			if(y>=1&&y<10){
				bketa = i+1;
			}
		}
		cketa = Math.max(aketa,bketa);
		return cketa;
	}
}