import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.HashMap;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DigitsMultiplication solver = new DigitsMultiplication();
        solver.solve(1, in, out);
        out.close();
    }

    static class DigitsMultiplication {
        long diff = Long.MAX_VALUE;
        long ansA;
        long ansB;

        static HashMap<Long, Long> primeFactorize(long x) {
            HashMap<Long, Long> result = new HashMap<>();
            for (long i = 2; i * i <= x; i++) {
                if (x % i != 0) {
                    continue;
                }
                long ex = 0;
                while (x % i == 0) {
                    ex++;
                    x /= i;
                }
                result.put(i, ex);
            }
            if (x != 1) {
                result.put(x, 1L);
            }
            return result;
        }

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long n = in.nextLong();

            HashMap<Long, Long> map = primeFactorize(n);
            List<Long> list = new ArrayList<>(map.keySet());
            List<Long> primes = new ArrayList<>();
            for (long key : list) {
                int limit = map.get(key).intValue();
                for (int i = 0; i < limit; i++) {
                    primes.add(key);
                }
            }

            dfs(primes, 0, 1, 1);

            int result = Math.max(
                    String.valueOf(ansA).length(),
                    String.valueOf(ansB).length()
            );
            out.println(result);
        }

        public void dfs(List<Long> list, int index, long a, long b) {
            if (index == list.size()) {
                if (Math.abs(a - b) < diff) {
                    diff = Math.abs(a - b);
                    ansA = a;
                    ansB = b;
                }
            } else {
                dfs(list, index + 1, a * list.get(index), b);
                dfs(list, index + 1, a, b * list.get(index));
            }
        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.List; List java.util import java.util.Scanner; Scanner java.util import java.util.HashMap; HashMap java.util import java.util.ArrayList; ArrayList java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DigitsMultiplication solver = new DigitsMultiplication();
        solver.solve(1, in, out);
        out.close();
    }

    static class DigitsMultiplication {
        long diff = Long.MAX_VALUE;
        long ansA;
        long ansB;

        static HashMap<Long, Long> primeFactorize(long x) {
            HashMap<Long, Long> result = new HashMap<>();
            for (long i = 2; i * i <= x; i++) {
                if (x % i != 0) {
                    continue;
                }
                long ex = 0;
                while (x % i == 0) {
                    ex++;
                    x /= i;
                }
                result.put(i, ex);
            }
            if (x != 1) {
                result.put(x, 1L);
            }
            return result;
        }

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long n = in.nextLong();

            HashMap<Long, Long> map = primeFactorize(n);
            List<Long> list = new ArrayList<>(map.keySet());
            List<Long> primes = new ArrayList<>();
            for (long key : list) {
                int limit = map.get(key).intValue();
                for (int i = 0; i < limit; i++) {
                    primes.add(key);
                }
            }

            dfs(primes, 0, 1, 1);

            int result = Math.max(
                    String.valueOf(ansA).length(),
                    String.valueOf(ansB).length()
            );
            out.println(result);
        }

        public void dfs(List<Long> list, int index, long a, long b) {
            if (index == list.size()) {
                if (Math.abs(a - b) < diff) {
                    diff = Math.abs(a - b);
                    ansA = a;
                    ansB = b;
                }
            } else {
                dfs(list, index + 1, a * list.get(index), b);
                dfs(list, index + 1, a, b * list.get(index));
            }
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DigitsMultiplication solver = new DigitsMultiplication();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DigitsMultiplication solver = new DigitsMultiplication();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) DigitsMultiplication solver = new DigitsMultiplication(); solver new DigitsMultiplication() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class DigitsMultiplication {
        long diff = Long.MAX_VALUE;
        long ansA;
        long ansB;

        static HashMap<Long, Long> primeFactorize(long x) {
            HashMap<Long, Long> result = new HashMap<>();
            for (long i = 2; i * i <= x; i++) {
                if (x % i != 0) {
                    continue;
                }
                long ex = 0;
                while (x % i == 0) {
                    ex++;
                    x /= i;
                }
                result.put(i, ex);
            }
            if (x != 1) {
                result.put(x, 1L);
            }
            return result;
        }

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long n = in.nextLong();

            HashMap<Long, Long> map = primeFactorize(n);
            List<Long> list = new ArrayList<>(map.keySet());
            List<Long> primes = new ArrayList<>();
            for (long key : list) {
                int limit = map.get(key).intValue();
                for (int i = 0; i < limit; i++) {
                    primes.add(key);
                }
            }

            dfs(primes, 0, 1, 1);

            int result = Math.max(
                    String.valueOf(ansA).length(),
                    String.valueOf(ansB).length()
            );
            out.println(result);
        }

        public void dfs(List<Long> list, int index, long a, long b) {
            if (index == list.size()) {
                if (Math.abs(a - b) < diff) {
                    diff = Math.abs(a - b);
                    ansA = a;
                    ansB = b;
                }
            } else {
                dfs(list, index + 1, a * list.get(index), b);
                dfs(list, index + 1, a, b * list.get(index));
            }
        }

    } DigitsMultiplication long diff = Long.MAX_VALUE; diff Long.MAX_VALUE Long Long.MAX_VALUE long ansA; ansA long ansB; ansB static HashMap<Long, Long> primeFactorize(long x) {
            HashMap<Long, Long> result = new HashMap<>();
            for (long i = 2; i * i <= x; i++) {
                if (x % i != 0) {
                    continue;
                }
                long ex = 0;
                while (x % i == 0) {
                    ex++;
                    x /= i;
                }
                result.put(i, ex);
            }
            if (x != 1) {
                result.put(x, 1L);
            }
            return result;
        } primeFactorize {
            HashMap<Long, Long> result = new HashMap<>();
            for (long i = 2; i * i <= x; i++) {
                if (x % i != 0) {
                    continue;
                }
                long ex = 0;
                while (x % i == 0) {
                    ex++;
                    x /= i;
                }
                result.put(i, ex);
            }
            if (x != 1) {
                result.put(x, 1L);
            }
            return result;
        } HashMap<Long, Long> result = new HashMap<>(); result new HashMap<>() for (long i = 2; i * i <= x; i++) {
                if (x % i != 0) {
                    continue;
                }
                long ex = 0;
                while (x % i == 0) {
                    ex++;
                    x /= i;
                }
                result.put(i, ex);
            } long i = 2; long i = 2; i 2 i * i <= x i * i i i x i++ i++ i {
                if (x % i != 0) {
                    continue;
                }
                long ex = 0;
                while (x % i == 0) {
                    ex++;
                    x /= i;
                }
                result.put(i, ex);
            } {
                if (x % i != 0) {
                    continue;
                }
                long ex = 0;
                while (x % i == 0) {
                    ex++;
                    x /= i;
                }
                result.put(i, ex);
            } if (x % i != 0) {
                    continue;
                } x % i != 0 x % i x i 0 {
                    continue;
                } continue; long ex = 0; ex 0 while (x % i == 0) {
                    ex++;
                    x /= i;
                } x % i == 0 x % i x i 0 {
                    ex++;
                    x /= i;
                } ex++ ex x /= i x i result.put(i, ex) result.put result i ex if (x != 1) {
                result.put(x, 1L);
            } x != 1 x 1 {
                result.put(x, 1L);
            } result.put(x, 1L) result.put result x 1L return result; result long x x public void solve(int testNumber, Scanner in, PrintWriter out) {
            long n = in.nextLong();

            HashMap<Long, Long> map = primeFactorize(n);
            List<Long> list = new ArrayList<>(map.keySet());
            List<Long> primes = new ArrayList<>();
            for (long key : list) {
                int limit = map.get(key).intValue();
                for (int i = 0; i < limit; i++) {
                    primes.add(key);
                }
            }

            dfs(primes, 0, 1, 1);

            int result = Math.max(
                    String.valueOf(ansA).length(),
                    String.valueOf(ansB).length()
            );
            out.println(result);
        } solve {
            long n = in.nextLong();

            HashMap<Long, Long> map = primeFactorize(n);
            List<Long> list = new ArrayList<>(map.keySet());
            List<Long> primes = new ArrayList<>();
            for (long key : list) {
                int limit = map.get(key).intValue();
                for (int i = 0; i < limit; i++) {
                    primes.add(key);
                }
            }

            dfs(primes, 0, 1, 1);

            int result = Math.max(
                    String.valueOf(ansA).length(),
                    String.valueOf(ansB).length()
            );
            out.println(result);
        } long n = in.nextLong(); n in.nextLong() in.nextLong in HashMap<Long, Long> map = primeFactorize(n); map primeFactorize(n) primeFactorize n List<Long> list = new ArrayList<>(map.keySet()); list new ArrayList<>(map.keySet()) List<Long> primes = new ArrayList<>(); primes new ArrayList<>() for (long key : list) {
                int limit = map.get(key).intValue();
                for (int i = 0; i < limit; i++) {
                    primes.add(key);
                }
            } long key list {
                int limit = map.get(key).intValue();
                for (int i = 0; i < limit; i++) {
                    primes.add(key);
                }
            } {
                int limit = map.get(key).intValue();
                for (int i = 0; i < limit; i++) {
                    primes.add(key);
                }
            } int limit = map.get(key).intValue(); limit map.get(key).intValue() map.get(key).intValue map.get(key) map.get map key for (int i = 0; i < limit; i++) {
                    primes.add(key);
                } int i = 0; int i = 0; i 0 i < limit i limit i++ i++ i {
                    primes.add(key);
                } {
                    primes.add(key);
                } primes.add(key) primes.add primes key dfs(primes, 0, 1, 1) dfs primes 0 1 1 int result = Math.max(
                    String.valueOf(ansA).length(),
                    String.valueOf(ansB).length()
            ); result Math.max(
                    String.valueOf(ansA).length(),
                    String.valueOf(ansB).length()
            ) Math.max Math String.valueOf(ansA).length() String.valueOf(ansA).length String.valueOf(ansA) String.valueOf String ansA String.valueOf(ansB).length() String.valueOf(ansB).length String.valueOf(ansB) String.valueOf String ansB out.println(result) out.println out result int testNumber testNumber Scanner in in PrintWriter out out public void dfs(List<Long> list, int index, long a, long b) {
            if (index == list.size()) {
                if (Math.abs(a - b) < diff) {
                    diff = Math.abs(a - b);
                    ansA = a;
                    ansB = b;
                }
            } else {
                dfs(list, index + 1, a * list.get(index), b);
                dfs(list, index + 1, a, b * list.get(index));
            }
        } dfs {
            if (index == list.size()) {
                if (Math.abs(a - b) < diff) {
                    diff = Math.abs(a - b);
                    ansA = a;
                    ansB = b;
                }
            } else {
                dfs(list, index + 1, a * list.get(index), b);
                dfs(list, index + 1, a, b * list.get(index));
            }
        } if (index == list.size()) {
                if (Math.abs(a - b) < diff) {
                    diff = Math.abs(a - b);
                    ansA = a;
                    ansB = b;
                }
            } else {
                dfs(list, index + 1, a * list.get(index), b);
                dfs(list, index + 1, a, b * list.get(index));
            } index == list.size() index list.size() list.size list {
                if (Math.abs(a - b) < diff) {
                    diff = Math.abs(a - b);
                    ansA = a;
                    ansB = b;
                }
            } if (Math.abs(a - b) < diff) {
                    diff = Math.abs(a - b);
                    ansA = a;
                    ansB = b;
                } Math.abs(a - b) < diff Math.abs(a - b) Math.abs Math a - b a b diff {
                    diff = Math.abs(a - b);
                    ansA = a;
                    ansB = b;
                } diff = Math.abs(a - b) diff Math.abs(a - b) Math.abs Math a - b a b ansA = a ansA a ansB = b ansB b {
                dfs(list, index + 1, a * list.get(index), b);
                dfs(list, index + 1, a, b * list.get(index));
            } dfs(list, index + 1, a * list.get(index), b) dfs list index + 1 index 1 a * list.get(index) a list.get(index) list.get list index b dfs(list, index + 1, a, b * list.get(index)) dfs list index + 1 index 1 a b * list.get(index) b list.get(index) list.get list index List<Long> list list int index index long a a long b b public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DigitsMultiplication solver = new DigitsMultiplication();
        solver.solve(1, in, out);
        out.close();
    }

    static class DigitsMultiplication {
        long diff = Long.MAX_VALUE;
        long ansA;
        long ansB;

        static HashMap<Long, Long> primeFactorize(long x) {
            HashMap<Long, Long> result = new HashMap<>();
            for (long i = 2; i * i <= x; i++) {
                if (x % i != 0) {
                    continue;
                }
                long ex = 0;
                while (x % i == 0) {
                    ex++;
                    x /= i;
                }
                result.put(i, ex);
            }
            if (x != 1) {
                result.put(x, 1L);
            }
            return result;
        }

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long n = in.nextLong();

            HashMap<Long, Long> map = primeFactorize(n);
            List<Long> list = new ArrayList<>(map.keySet());
            List<Long> primes = new ArrayList<>();
            for (long key : list) {
                int limit = map.get(key).intValue();
                for (int i = 0; i < limit; i++) {
                    primes.add(key);
                }
            }

            dfs(primes, 0, 1, 1);

            int result = Math.max(
                    String.valueOf(ansA).length(),
                    String.valueOf(ansB).length()
            );
            out.println(result);
        }

        public void dfs(List<Long> list, int index, long a, long b) {
            if (index == list.size()) {
                if (Math.abs(a - b) < diff) {
                    diff = Math.abs(a - b);
                    ansA = a;
                    ansB = b;
                }
            } else {
                dfs(list, index + 1, a * list.get(index), b);
                dfs(list, index + 1, a, b * list.get(index));
            }
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DigitsMultiplication solver = new DigitsMultiplication();
        solver.solve(1, in, out);
        out.close();
    }

    static class DigitsMultiplication {
        long diff = Long.MAX_VALUE;
        long ansA;
        long ansB;

        static HashMap<Long, Long> primeFactorize(long x) {
            HashMap<Long, Long> result = new HashMap<>();
            for (long i = 2; i * i <= x; i++) {
                if (x % i != 0) {
                    continue;
                }
                long ex = 0;
                while (x % i == 0) {
                    ex++;
                    x /= i;
                }
                result.put(i, ex);
            }
            if (x != 1) {
                result.put(x, 1L);
            }
            return result;
        }

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long n = in.nextLong();

            HashMap<Long, Long> map = primeFactorize(n);
            List<Long> list = new ArrayList<>(map.keySet());
            List<Long> primes = new ArrayList<>();
            for (long key : list) {
                int limit = map.get(key).intValue();
                for (int i = 0; i < limit; i++) {
                    primes.add(key);
                }
            }

            dfs(primes, 0, 1, 1);

            int result = Math.max(
                    String.valueOf(ansA).length(),
                    String.valueOf(ansB).length()
            );
            out.println(result);
        }

        public void dfs(List<Long> list, int index, long a, long b) {
            if (index == list.size()) {
                if (Math.abs(a - b) < diff) {
                    diff = Math.abs(a - b);
                    ansA = a;
                    ansB = b;
                }
            } else {
                dfs(list, index + 1, a * list.get(index), b);
                dfs(list, index + 1, a, b * list.get(index));
            }
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.HashMap;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DigitsMultiplication solver = new DigitsMultiplication();
        solver.solve(1, in, out);
        out.close();
    }

    static class DigitsMultiplication {
        long diff = Long.MAX_VALUE;
        long ansA;
        long ansB;

        static HashMap<Long, Long> primeFactorize(long x) {
            HashMap<Long, Long> result = new HashMap<>();
            for (long i = 2; i * i <= x; i++) {
                if (x % i != 0) {
                    continue;
                }
                long ex = 0;
                while (x % i == 0) {
                    ex++;
                    x /= i;
                }
                result.put(i, ex);
            }
            if (x != 1) {
                result.put(x, 1L);
            }
            return result;
        }

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long n = in.nextLong();

            HashMap<Long, Long> map = primeFactorize(n);
            List<Long> list = new ArrayList<>(map.keySet());
            List<Long> primes = new ArrayList<>();
            for (long key : list) {
                int limit = map.get(key).intValue();
                for (int i = 0; i < limit; i++) {
                    primes.add(key);
                }
            }

            dfs(primes, 0, 1, 1);

            int result = Math.max(
                    String.valueOf(ansA).length(),
                    String.valueOf(ansB).length()
            );
            out.println(result);
        }

        public void dfs(List<Long> list, int index, long a, long b) {
            if (index == list.size()) {
                if (Math.abs(a - b) < diff) {
                    diff = Math.abs(a - b);
                    ansA = a;
                    ansB = b;
                }
            } else {
                dfs(list, index + 1, a * list.get(index), b);
                dfs(list, index + 1, a, b * list.get(index));
            }
        }

    }
}

