import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.*;
import java.util.function.IntFunction;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;


public class Main {
    static int[] waru;
    static long nn;
    public static void main(String[] args) {
        Scanner scanner = new Scanner();
        long n=scanner.nextLong();
        nn=n;
        waru=new int[100_000];
        for(int i=0;i<waru.length&&n>1;i++){
            //put(i+2);
            while(n%(i+2)==0){
                //put(format("%dは%dで割り切れた",n,i+2));
                waru[i]++;
                n/=(i+2);
            }
        }
        //put(Arrays.toString(waru));
        put(min(1,0));





    }
    public static int keta(long a){
        int result=0;
        while(a>0){
            a/=10;
            result++;
        }
        return result;
    }
    public static long min(long val,int index){
        while(index<waru.length&&waru[index]==0){
            index++;
        }
        if(index>=waru.length){
            //put("val="+val);
            //put(String.format("%d %d",keta(val),keta(nn/val)));
            return Math.max(keta(val),keta(nn/val));
        }
        //put(format("val=%d,index=%d,waru[%d]=%d",val,index,index,waru[index]));
        long min=Long.MAX_VALUE;
        long a=1;
        for(int i=0;i<=waru[index];i++){
            min=Math.min(min(val*a,index+1),min);
            a*=index+2;
        }
        return min;
    }

    public static int upper_bound(int[] a,int val){
        return upper_bound(a,0,a.length,val);
    }
    public static int upper_bound(int[] a,int l,int r,int val){
        if(r-l==1){
            if(a[l]>val) return l;
            return r;
        }
        int mid=(l+r)/2;
        if(a[mid]>val){
            return upper_bound(a,l,mid,val);
        }else{
            return upper_bound(a,mid,r,val);
        }
    }
    public static int lower_bound(int[] a,int val){
        return lower_bound(a,0,a.length,val);
    }
    public static int lower_bound(int[] a,int l,int r,int val){
        if(r-l==1){
            if(a[l]<val) return r;
            return l;
        }
        int mid=(l+r)/2;
        if(a[mid]<val){
            return lower_bound(a,mid,r,val);
        }else{
            return lower_bound(a,l,mid,val);
        }

    }


    public static int max(int a,int b){
        return Math.max(a,b);
    }
    public static long max(long a,long b){
        return Math.max(a,b);
    }
    public static int abs(int a){
        return Math.abs(a);
    }
    public static long abs(long a){
        return Math.abs(a);
    }
    public static void print(Object object){
        System.out.print(object);
    }
    public static void put(Object object) {
        System.out.println(object);
    }
    public static void put(){
        System.out.println();
    }
    public static String format(String string, Object... args) {
        return String.format(string, args);
    }
}

final class Scanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
} import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.math.BigDecimal; BigDecimal java.math import java.util.*; util.* java import java.util.function.IntFunction; IntFunction java.util.function import java.util.function.Supplier; Supplier java.util.function import java.util.stream.Collectors; Collectors java.util.stream import java.util.stream.IntStream; IntStream java.util.stream import java.util.stream.Stream; Stream java.util.stream public class Main {
    static int[] waru;
    static long nn;
    public static void main(String[] args) {
        Scanner scanner = new Scanner();
        long n=scanner.nextLong();
        nn=n;
        waru=new int[100_000];
        for(int i=0;i<waru.length&&n>1;i++){
            //put(i+2);
            while(n%(i+2)==0){
                //put(format("%dは%dで割り切れた",n,i+2));
                waru[i]++;
                n/=(i+2);
            }
        }
        //put(Arrays.toString(waru));
        put(min(1,0));





    }
    public static int keta(long a){
        int result=0;
        while(a>0){
            a/=10;
            result++;
        }
        return result;
    }
    public static long min(long val,int index){
        while(index<waru.length&&waru[index]==0){
            index++;
        }
        if(index>=waru.length){
            //put("val="+val);
            //put(String.format("%d %d",keta(val),keta(nn/val)));
            return Math.max(keta(val),keta(nn/val));
        }
        //put(format("val=%d,index=%d,waru[%d]=%d",val,index,index,waru[index]));
        long min=Long.MAX_VALUE;
        long a=1;
        for(int i=0;i<=waru[index];i++){
            min=Math.min(min(val*a,index+1),min);
            a*=index+2;
        }
        return min;
    }

    public static int upper_bound(int[] a,int val){
        return upper_bound(a,0,a.length,val);
    }
    public static int upper_bound(int[] a,int l,int r,int val){
        if(r-l==1){
            if(a[l]>val) return l;
            return r;
        }
        int mid=(l+r)/2;
        if(a[mid]>val){
            return upper_bound(a,l,mid,val);
        }else{
            return upper_bound(a,mid,r,val);
        }
    }
    public static int lower_bound(int[] a,int val){
        return lower_bound(a,0,a.length,val);
    }
    public static int lower_bound(int[] a,int l,int r,int val){
        if(r-l==1){
            if(a[l]<val) return r;
            return l;
        }
        int mid=(l+r)/2;
        if(a[mid]<val){
            return lower_bound(a,mid,r,val);
        }else{
            return lower_bound(a,l,mid,val);
        }

    }


    public static int max(int a,int b){
        return Math.max(a,b);
    }
    public static long max(long a,long b){
        return Math.max(a,b);
    }
    public static int abs(int a){
        return Math.abs(a);
    }
    public static long abs(long a){
        return Math.abs(a);
    }
    public static void print(Object object){
        System.out.print(object);
    }
    public static void put(Object object) {
        System.out.println(object);
    }
    public static void put(){
        System.out.println();
    }
    public static String format(String string, Object... args) {
        return String.format(string, args);
    }
} Main static int[] waru; waru static long nn; nn public static void main(String[] args) {
        Scanner scanner = new Scanner();
        long n=scanner.nextLong();
        nn=n;
        waru=new int[100_000];
        for(int i=0;i<waru.length&&n>1;i++){
            //put(i+2);
            while(n%(i+2)==0){
                //put(format("%dは%dで割り切れた",n,i+2));
                waru[i]++;
                n/=(i+2);
            }
        }
        //put(Arrays.toString(waru));
        put(min(1,0));





    } main {
        Scanner scanner = new Scanner();
        long n=scanner.nextLong();
        nn=n;
        waru=new int[100_000];
        for(int i=0;i<waru.length&&n>1;i++){
            //put(i+2);
            while(n%(i+2)==0){
                //put(format("%dは%dで割り切れた",n,i+2));
                waru[i]++;
                n/=(i+2);
            }
        }
        //put(Arrays.toString(waru));
        put(min(1,0));





    } Scanner scanner = new Scanner(); scanner new Scanner() long n=scanner.nextLong(); n scanner.nextLong() scanner.nextLong scanner nn=n nn n waru=new int[100_000] waru new int[100_000] 100_000 for(int i=0;i<waru.length&&n>1;i++){
            //put(i+2);
            while(n%(i+2)==0){
                //put(format("%dは%dで割り切れた",n,i+2));
                waru[i]++;
                n/=(i+2);
            }
        } int i=0; int i=0; i 0 i<waru.length&&n>1 i<waru.length i waru.length waru waru.length n>1 n 1 i++ i++ i {
            //put(i+2);
            while(n%(i+2)==0){
                //put(format("%dは%dで割り切れた",n,i+2));
                waru[i]++;
                n/=(i+2);
            }
        } {
            //put(i+2);
            while(n%(i+2)==0){
                //put(format("%dは%dで割り切れた",n,i+2));
                waru[i]++;
                n/=(i+2);
            }
        } while(n%(i+2)==0){
                //put(format("%dは%dで割り切れた",n,i+2));
                waru[i]++;
                n/=(i+2);
            } n%(i+2)==0 n%(i+2) n (i+2) i 2 0 {
                //put(format("%dは%dで割り切れた",n,i+2));
                waru[i]++;
                n/=(i+2);
            } waru[i]++ waru[i] waru i n/=(i+2) n (i+2) i 2 put(min(1,0)) put min(1,0) min 1 0 String[] args args public static int keta(long a){
        int result=0;
        while(a>0){
            a/=10;
            result++;
        }
        return result;
    } keta {
        int result=0;
        while(a>0){
            a/=10;
            result++;
        }
        return result;
    } int result=0; result 0 while(a>0){
            a/=10;
            result++;
        } a>0 a 0 {
            a/=10;
            result++;
        } a/=10 a 10 result++ result return result; result long a a public static long min(long val,int index){
        while(index<waru.length&&waru[index]==0){
            index++;
        }
        if(index>=waru.length){
            //put("val="+val);
            //put(String.format("%d %d",keta(val),keta(nn/val)));
            return Math.max(keta(val),keta(nn/val));
        }
        //put(format("val=%d,index=%d,waru[%d]=%d",val,index,index,waru[index]));
        long min=Long.MAX_VALUE;
        long a=1;
        for(int i=0;i<=waru[index];i++){
            min=Math.min(min(val*a,index+1),min);
            a*=index+2;
        }
        return min;
    } min {
        while(index<waru.length&&waru[index]==0){
            index++;
        }
        if(index>=waru.length){
            //put("val="+val);
            //put(String.format("%d %d",keta(val),keta(nn/val)));
            return Math.max(keta(val),keta(nn/val));
        }
        //put(format("val=%d,index=%d,waru[%d]=%d",val,index,index,waru[index]));
        long min=Long.MAX_VALUE;
        long a=1;
        for(int i=0;i<=waru[index];i++){
            min=Math.min(min(val*a,index+1),min);
            a*=index+2;
        }
        return min;
    } while(index<waru.length&&waru[index]==0){
            index++;
        } index<waru.length&&waru[index]==0 index<waru.length index waru.length waru waru.length waru[index]==0 waru[index] waru index 0 {
            index++;
        } index++ index if(index>=waru.length){
            //put("val="+val);
            //put(String.format("%d %d",keta(val),keta(nn/val)));
            return Math.max(keta(val),keta(nn/val));
        } index>=waru.length index waru.length waru waru.length {
            //put("val="+val);
            //put(String.format("%d %d",keta(val),keta(nn/val)));
            return Math.max(keta(val),keta(nn/val));
        } return Math.max(keta(val),keta(nn/val)); Math.max(keta(val),keta(nn/val)) Math.max Math keta(val) keta val keta(nn/val) keta nn/val nn val long min=Long.MAX_VALUE; min Long.MAX_VALUE Long Long.MAX_VALUE long a=1; a 1 for(int i=0;i<=waru[index];i++){
            min=Math.min(min(val*a,index+1),min);
            a*=index+2;
        } int i=0; int i=0; i 0 i<=waru[index] i waru[index] waru index i++ i++ i {
            min=Math.min(min(val*a,index+1),min);
            a*=index+2;
        } {
            min=Math.min(min(val*a,index+1),min);
            a*=index+2;
        } min=Math.min(min(val*a,index+1),min) min Math.min(min(val*a,index+1),min) Math.min Math min(val*a,index+1) min val*a val a index+1 index 1 min a*=index+2 a index+2 index 2 return min; min long val val int index index public static int upper_bound(int[] a,int val){
        return upper_bound(a,0,a.length,val);
    } upper_bound {
        return upper_bound(a,0,a.length,val);
    } return upper_bound(a,0,a.length,val); upper_bound(a,0,a.length,val) upper_bound a 0 a.length a a.length val int[] a a int val val public static int upper_bound(int[] a,int l,int r,int val){
        if(r-l==1){
            if(a[l]>val) return l;
            return r;
        }
        int mid=(l+r)/2;
        if(a[mid]>val){
            return upper_bound(a,l,mid,val);
        }else{
            return upper_bound(a,mid,r,val);
        }
    } upper_bound {
        if(r-l==1){
            if(a[l]>val) return l;
            return r;
        }
        int mid=(l+r)/2;
        if(a[mid]>val){
            return upper_bound(a,l,mid,val);
        }else{
            return upper_bound(a,mid,r,val);
        }
    } if(r-l==1){
            if(a[l]>val) return l;
            return r;
        } r-l==1 r-l r l 1 {
            if(a[l]>val) return l;
            return r;
        } if(a[l]>val) return l; a[l]>val a[l] a l val return l; l return r; r int mid=(l+r)/2; mid (l+r)/2 (l+r) l r 2 if(a[mid]>val){
            return upper_bound(a,l,mid,val);
        }else{
            return upper_bound(a,mid,r,val);
        } a[mid]>val a[mid] a mid val {
            return upper_bound(a,l,mid,val);
        } return upper_bound(a,l,mid,val); upper_bound(a,l,mid,val) upper_bound a l mid val {
            return upper_bound(a,mid,r,val);
        } return upper_bound(a,mid,r,val); upper_bound(a,mid,r,val) upper_bound a mid r val int[] a a int l l int r r int val val public static int lower_bound(int[] a,int val){
        return lower_bound(a,0,a.length,val);
    } lower_bound {
        return lower_bound(a,0,a.length,val);
    } return lower_bound(a,0,a.length,val); lower_bound(a,0,a.length,val) lower_bound a 0 a.length a a.length val int[] a a int val val public static int lower_bound(int[] a,int l,int r,int val){
        if(r-l==1){
            if(a[l]<val) return r;
            return l;
        }
        int mid=(l+r)/2;
        if(a[mid]<val){
            return lower_bound(a,mid,r,val);
        }else{
            return lower_bound(a,l,mid,val);
        }

    } lower_bound {
        if(r-l==1){
            if(a[l]<val) return r;
            return l;
        }
        int mid=(l+r)/2;
        if(a[mid]<val){
            return lower_bound(a,mid,r,val);
        }else{
            return lower_bound(a,l,mid,val);
        }

    } if(r-l==1){
            if(a[l]<val) return r;
            return l;
        } r-l==1 r-l r l 1 {
            if(a[l]<val) return r;
            return l;
        } if(a[l]<val) return r; a[l]<val a[l] a l val return r; r return l; l int mid=(l+r)/2; mid (l+r)/2 (l+r) l r 2 if(a[mid]<val){
            return lower_bound(a,mid,r,val);
        }else{
            return lower_bound(a,l,mid,val);
        } a[mid]<val a[mid] a mid val {
            return lower_bound(a,mid,r,val);
        } return lower_bound(a,mid,r,val); lower_bound(a,mid,r,val) lower_bound a mid r val {
            return lower_bound(a,l,mid,val);
        } return lower_bound(a,l,mid,val); lower_bound(a,l,mid,val) lower_bound a l mid val int[] a a int l l int r r int val val public static int max(int a,int b){
        return Math.max(a,b);
    } max {
        return Math.max(a,b);
    } return Math.max(a,b); Math.max(a,b) Math.max Math a b int a a int b b public static long max(long a,long b){
        return Math.max(a,b);
    } max {
        return Math.max(a,b);
    } return Math.max(a,b); Math.max(a,b) Math.max Math a b long a a long b b public static int abs(int a){
        return Math.abs(a);
    } abs {
        return Math.abs(a);
    } return Math.abs(a); Math.abs(a) Math.abs Math a int a a public static long abs(long a){
        return Math.abs(a);
    } abs {
        return Math.abs(a);
    } return Math.abs(a); Math.abs(a) Math.abs Math a long a a public static void print(Object object){
        System.out.print(object);
    } print {
        System.out.print(object);
    } System.out.print(object) System.out.print System.out System System.out object Object object object public static void put(Object object) {
        System.out.println(object);
    } put {
        System.out.println(object);
    } System.out.println(object) System.out.println System.out System System.out object Object object object public static void put(){
        System.out.println();
    } put {
        System.out.println();
    } System.out.println() System.out.println System.out System System.out public static String format(String string, Object... args) {
        return String.format(string, args);
    } format {
        return String.format(string, args);
    } return String.format(string, args); String.format(string, args) String.format String string args String string string Object... args args final class Scanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
} Scanner private final InputStream in = System.in; in System.in System System.in private final byte[] buffer = new byte[1024]; buffer new byte[1024] 1024 private int ptr = 0; ptr 0 private int buflen = 0; buflen 0 private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    } hasNextByte {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    } if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        } ptr < buflen ptr buflen {
            return true;
        } return true; true {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        } ptr = 0 ptr 0 try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } IOException e {
                e.printStackTrace();
            } e.printStackTrace() e.printStackTrace e {
                buflen = in.read(buffer);
            } buflen = in.read(buffer) buflen in.read(buffer) in.read in buffer if (buflen <= 0) {
                return false;
            } buflen <= 0 buflen 0 {
                return false;
            } return false; false return true; true private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    } readByte {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    } if (hasNextByte())
            return buffer[ptr++];
        else
            return -1; hasNextByte() hasNextByte return buffer[ptr++]; buffer[ptr++] buffer ptr++ ptr return -1; -1 1 private boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    } isPrintableChar {
        return 33 <= c && c <= 126;
    } return 33 <= c && c <= 126; 33 <= c && c <= 126 33 <= c 33 c c <= 126 c 126 int c c public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    } hasNext {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    } while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++; hasNextByte() && !isPrintableChar(buffer[ptr]) hasNextByte() hasNextByte !isPrintableChar(buffer[ptr]) isPrintableChar(buffer[ptr]) isPrintableChar buffer[ptr] buffer ptr ptr++ ptr return hasNextByte(); hasNextByte() hasNextByte public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    } next {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    } if (!hasNext())
            throw new NoSuchElementException(); !hasNext() hasNext() hasNext throw new NoSuchElementException(); new NoSuchElementException() StringBuilder sb = new StringBuilder(); sb new StringBuilder() int b = readByte(); b readByte() readByte while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        } isPrintableChar(b) isPrintableChar b {
            sb.appendCodePoint(b);
            b = readByte();
        } sb.appendCodePoint(b) sb.appendCodePoint sb b b = readByte() b readByte() readByte return sb.toString(); sb.toString() sb.toString sb public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    } nextLong {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    } if (!hasNext())
            throw new NoSuchElementException(); !hasNext() hasNext() hasNext throw new NoSuchElementException(); new NoSuchElementException() long n = 0; n 0 boolean minus = false; minus false int b = readByte(); b readByte() readByte if (b == '-') {
            minus = true;
            b = readByte();
        } b == '-' b '-' {
            minus = true;
            b = readByte();
        } minus = true minus true b = readByte() b readByte() readByte if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        } b < '0' || '9' < b b < '0' b '0' '9' < b '9' b {
            throw new NumberFormatException();
        } throw new NumberFormatException(); new NumberFormatException() while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        } true {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        } if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            } '0' <= b && b <= '9' '0' <= b '0' b b <= '9' b '9' {
                n *= 10;
                n += b - '0';
            } n *= 10 n 10 n += b - '0' n b - '0' b '0' if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            } b == -1 || !isPrintableChar(b) b == -1 b -1 1 !isPrintableChar(b) isPrintableChar(b) isPrintableChar b {
                return minus ? -n : n;
            } return minus ? -n : n; minus ? -n : n minus -n n n {
                throw new NumberFormatException();
            } throw new NumberFormatException(); new NumberFormatException() b = readByte() b readByte() readByte public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    } nextInt {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    } long nl = nextLong(); nl nextLong() nextLong if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException(); nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE nl < Integer.MIN_VALUE nl Integer.MIN_VALUE Integer Integer.MIN_VALUE nl > Integer.MAX_VALUE nl Integer.MAX_VALUE Integer Integer.MAX_VALUE throw new NumberFormatException(); new NumberFormatException() return (int) nl; (int) nl public double nextDouble() {
        return Double.parseDouble(next());
    } nextDouble {
        return Double.parseDouble(next());
    } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next public class Main {
    static int[] waru;
    static long nn;
    public static void main(String[] args) {
        Scanner scanner = new Scanner();
        long n=scanner.nextLong();
        nn=n;
        waru=new int[100_000];
        for(int i=0;i<waru.length&&n>1;i++){
            //put(i+2);
            while(n%(i+2)==0){
                //put(format("%dは%dで割り切れた",n,i+2));
                waru[i]++;
                n/=(i+2);
            }
        }
        //put(Arrays.toString(waru));
        put(min(1,0));





    }
    public static int keta(long a){
        int result=0;
        while(a>0){
            a/=10;
            result++;
        }
        return result;
    }
    public static long min(long val,int index){
        while(index<waru.length&&waru[index]==0){
            index++;
        }
        if(index>=waru.length){
            //put("val="+val);
            //put(String.format("%d %d",keta(val),keta(nn/val)));
            return Math.max(keta(val),keta(nn/val));
        }
        //put(format("val=%d,index=%d,waru[%d]=%d",val,index,index,waru[index]));
        long min=Long.MAX_VALUE;
        long a=1;
        for(int i=0;i<=waru[index];i++){
            min=Math.min(min(val*a,index+1),min);
            a*=index+2;
        }
        return min;
    }

    public static int upper_bound(int[] a,int val){
        return upper_bound(a,0,a.length,val);
    }
    public static int upper_bound(int[] a,int l,int r,int val){
        if(r-l==1){
            if(a[l]>val) return l;
            return r;
        }
        int mid=(l+r)/2;
        if(a[mid]>val){
            return upper_bound(a,l,mid,val);
        }else{
            return upper_bound(a,mid,r,val);
        }
    }
    public static int lower_bound(int[] a,int val){
        return lower_bound(a,0,a.length,val);
    }
    public static int lower_bound(int[] a,int l,int r,int val){
        if(r-l==1){
            if(a[l]<val) return r;
            return l;
        }
        int mid=(l+r)/2;
        if(a[mid]<val){
            return lower_bound(a,mid,r,val);
        }else{
            return lower_bound(a,l,mid,val);
        }

    }


    public static int max(int a,int b){
        return Math.max(a,b);
    }
    public static long max(long a,long b){
        return Math.max(a,b);
    }
    public static int abs(int a){
        return Math.abs(a);
    }
    public static long abs(long a){
        return Math.abs(a);
    }
    public static void print(Object object){
        System.out.print(object);
    }
    public static void put(Object object) {
        System.out.println(object);
    }
    public static void put(){
        System.out.println();
    }
    public static String format(String string, Object... args) {
        return String.format(string, args);
    }
} public class Main {
    static int[] waru;
    static long nn;
    public static void main(String[] args) {
        Scanner scanner = new Scanner();
        long n=scanner.nextLong();
        nn=n;
        waru=new int[100_000];
        for(int i=0;i<waru.length&&n>1;i++){
            //put(i+2);
            while(n%(i+2)==0){
                //put(format("%dは%dで割り切れた",n,i+2));
                waru[i]++;
                n/=(i+2);
            }
        }
        //put(Arrays.toString(waru));
        put(min(1,0));





    }
    public static int keta(long a){
        int result=0;
        while(a>0){
            a/=10;
            result++;
        }
        return result;
    }
    public static long min(long val,int index){
        while(index<waru.length&&waru[index]==0){
            index++;
        }
        if(index>=waru.length){
            //put("val="+val);
            //put(String.format("%d %d",keta(val),keta(nn/val)));
            return Math.max(keta(val),keta(nn/val));
        }
        //put(format("val=%d,index=%d,waru[%d]=%d",val,index,index,waru[index]));
        long min=Long.MAX_VALUE;
        long a=1;
        for(int i=0;i<=waru[index];i++){
            min=Math.min(min(val*a,index+1),min);
            a*=index+2;
        }
        return min;
    }

    public static int upper_bound(int[] a,int val){
        return upper_bound(a,0,a.length,val);
    }
    public static int upper_bound(int[] a,int l,int r,int val){
        if(r-l==1){
            if(a[l]>val) return l;
            return r;
        }
        int mid=(l+r)/2;
        if(a[mid]>val){
            return upper_bound(a,l,mid,val);
        }else{
            return upper_bound(a,mid,r,val);
        }
    }
    public static int lower_bound(int[] a,int val){
        return lower_bound(a,0,a.length,val);
    }
    public static int lower_bound(int[] a,int l,int r,int val){
        if(r-l==1){
            if(a[l]<val) return r;
            return l;
        }
        int mid=(l+r)/2;
        if(a[mid]<val){
            return lower_bound(a,mid,r,val);
        }else{
            return lower_bound(a,l,mid,val);
        }

    }


    public static int max(int a,int b){
        return Math.max(a,b);
    }
    public static long max(long a,long b){
        return Math.max(a,b);
    }
    public static int abs(int a){
        return Math.abs(a);
    }
    public static long abs(long a){
        return Math.abs(a);
    }
    public static void print(Object object){
        System.out.print(object);
    }
    public static void put(Object object) {
        System.out.println(object);
    }
    public static void put(){
        System.out.println();
    }
    public static String format(String string, Object... args) {
        return String.format(string, args);
    }
} Main
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.*;
import java.util.function.IntFunction;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;


public class Main {
    static int[] waru;
    static long nn;
    public static void main(String[] args) {
        Scanner scanner = new Scanner();
        long n=scanner.nextLong();
        nn=n;
        waru=new int[100_000];
        for(int i=0;i<waru.length&&n>1;i++){
            //put(i+2);
            while(n%(i+2)==0){
                //put(format("%dは%dで割り切れた",n,i+2));
                waru[i]++;
                n/=(i+2);
            }
        }
        //put(Arrays.toString(waru));
        put(min(1,0));





    }
    public static int keta(long a){
        int result=0;
        while(a>0){
            a/=10;
            result++;
        }
        return result;
    }
    public static long min(long val,int index){
        while(index<waru.length&&waru[index]==0){
            index++;
        }
        if(index>=waru.length){
            //put("val="+val);
            //put(String.format("%d %d",keta(val),keta(nn/val)));
            return Math.max(keta(val),keta(nn/val));
        }
        //put(format("val=%d,index=%d,waru[%d]=%d",val,index,index,waru[index]));
        long min=Long.MAX_VALUE;
        long a=1;
        for(int i=0;i<=waru[index];i++){
            min=Math.min(min(val*a,index+1),min);
            a*=index+2;
        }
        return min;
    }

    public static int upper_bound(int[] a,int val){
        return upper_bound(a,0,a.length,val);
    }
    public static int upper_bound(int[] a,int l,int r,int val){
        if(r-l==1){
            if(a[l]>val) return l;
            return r;
        }
        int mid=(l+r)/2;
        if(a[mid]>val){
            return upper_bound(a,l,mid,val);
        }else{
            return upper_bound(a,mid,r,val);
        }
    }
    public static int lower_bound(int[] a,int val){
        return lower_bound(a,0,a.length,val);
    }
    public static int lower_bound(int[] a,int l,int r,int val){
        if(r-l==1){
            if(a[l]<val) return r;
            return l;
        }
        int mid=(l+r)/2;
        if(a[mid]<val){
            return lower_bound(a,mid,r,val);
        }else{
            return lower_bound(a,l,mid,val);
        }

    }


    public static int max(int a,int b){
        return Math.max(a,b);
    }
    public static long max(long a,long b){
        return Math.max(a,b);
    }
    public static int abs(int a){
        return Math.abs(a);
    }
    public static long abs(long a){
        return Math.abs(a);
    }
    public static void print(Object object){
        System.out.print(object);
    }
    public static void put(Object object) {
        System.out.println(object);
    }
    public static void put(){
        System.out.println();
    }
    public static String format(String string, Object... args) {
        return String.format(string, args);
    }
}

final class Scanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}