CodeEff/ECCO huggingface dataset:
# Original solution
import sys

c=["light fly", "fly", "bantam", "feather", "light", "light welter",
   "welter", "light middle", "middle", "light heavy", "heavy"]
w=[48,51,54,57,60,64,69,75,81,91]
for s in map(float,sys.stdin):
    i=0
    while i<len(w) and w[i]<s:
        i+=1
    print(c[i])

# Optimized solution
import sys

c=["light fly", "fly", "bantam", "feather", "light", "light welter",
   "welter", "light middle", "middle", "light heavy", "heavy"]
w=[48,51,54,57,60,64,69,75,81,91]
for s in map(float,sys.stdin):
    i=0
    for e in w:
        if e<s: i+=1
    print(c[i])
# Original solution
import statistics
n=int(eval(input()))
a=list(map(int,input().split()))
num=round(statistics.mean(a))
print((sum([(num-i)**2 for i in a])))

# Optimized solution
eval(input());a=list(map(int,input().split()));r=float('inf')
for i in range(min(a),max(a)+1):
  n=0
  for j in a:
    n+=(j-i)**2
  r=min(n,r)
print(r)
# Original solution
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def LI2(): return [int(eval(input())) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print(('\n'.join(x)))
def printni(x): print(('\n'.join(list(map(str,x)))))
inf = 10**17
mod = 10**9 + 7

n=I()
lis=LI()
mn=inf
for i in range(-100,100+1):
    sm=0
    for s in lis:
        sm+=(s-i)**2
    if sm<mn:
        mn=sm
print(mn)

# Optimized solution
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def LI2(): return [int(eval(input())) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print(('\n'.join(x)))
def printni(x): print(('\n'.join(list(map(str,x)))))
inf = 10**17
mod = 10**9 + 7

n=I()
lis=LI()
U,V=0,0
u=ceil(sum(lis)/n)
v=int(sum(lis)/n)
for i in range(n):
    U+=(lis[i]-u)**2
    V+=(lis[i]-v)**2
print((min(U,V)))
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
mn = 10**9
for i in range(-100,101):
    x = 0
    for j in a:
        x += (j-i)**2
    mn = min(mn,x)
print(mn)

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
x = round(sum(a)/n)
ans = 0
for i in a:
    ans += (i-x)**2
print(ans)
# Original solution
num = int(eval(input()))
A = list(map(int, input().split()))

sumA = sum(A)
obj = round(sumA/num)
sum2A = 0
for i in range(num):
    sum2A += A[i] ** 2
print((sum2A - (2*obj*sumA) + (num*obj**2)))

# Optimized solution
num = int(eval(input()))
A = list(map(int, input().split()))

sumA = sum(A)
obj = round(sumA/num)
ans = 0
for i in range(num):
    ans += (A[i]-obj) ** 2
print(ans)
# Original solution
N = int(eval(input()))
a = list(map(int,input().split()))
ave = sum(a)/N
ave = round(ave)
sum = 0
for i in a:
    sum += (i-ave)**2
print(sum)


# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))

ave = round(sum(a)/n)
cost=0
for i in range(n):
    cost+=(a[i]-ave)**2
print(cost)
# Original solution
n = int(eval(input()))
a_array = [int(x) for x in input().split()]
ans = float("inf")
for i in range(-100, 101):
    tmp = 0
    for a in a_array:
        tmp += abs(a-i)**2
    ans = min(ans, tmp)
print(ans)


# Optimized solution
n = int(eval(input()))
a_array = [int(x) for x in input().split()]
sum_a = sum(a_array)
if sum_a % n == 0:
    sum_a = int(sum_a/len(a_array))
    ans = 0
    for a in a_array:
        ans += abs(sum_a-a)**2
    print((int(ans)))
else:
    sum_a1 = int(sum_a/len(a_array))
    sum_a2 = int(sum_a/len(a_array))+1
    ans1 = 0
    ans2 = 0
    for a in a_array:
        ans1 += abs(sum_a1-a)**2
        ans2 += abs(sum_a2-a)**2
    print((int(min(ans1, ans2))))
# Original solution
N=int(eval(input()))
a=[int(i) for i in input().split()]

ave=round(sum(a)/len(a))

cost=0
for i in a:
    cost+=(i-ave)**2
print(cost)

# Optimized solution
n=int(eval(input()))
a=[int(i) for i in input().split()]

ave=round(sum(a)/len(a))

cost=0
for i in a:
    cost+=(ave-i)**2
print(cost)
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
ave=round(sum(a)/n)
a=[(x-ave)**2 for x in a]
print((sum(a)))


# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
avg=round(sum(a)/n)
ans=0
for i in range(n):
    ans+=(a[i]-avg)**2
print(ans)
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
total=0
ans=[]
for i in range(-100,101):
    for j in a:
        if j!=i:
            total+=(i-j)**2
    ans.append(total)
    total=0
print((min(ans)))

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
ans=float("inf")
for i in range(-100,101):
    cost=0
    for j in range(n):
        cost+=(i-a[j])**2
    ans=min(cost,ans)
print(ans)
# Original solution
N = int(eval(input()))
a = [int(i) for i in input().split()]
ans = float("inf")
for i in range(-100, 101):
    ans = min(sum([(n - i)** 2 for n in a]), ans)
print(ans)

# Optimized solution
N=int(eval(input()));a=[int(i) for i in input().split()]
print((min([sum([(n-i)**2 for n in a])for i in range(-100,101)])))
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
ans=float('inf')
for i in range(-100, 101):
    tmp=0
    for j in range(n):
        tmp+=(i-a[j])**2
    ans=min(tmp,ans)
print(ans)


# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
mean=sum(a)//n
ans=float('inf')
for i in range(5):
    t=(mean-2)+i
    tmp=0
    for j in range(n):
        tmp+=(a[j]-t)**2
    ans=min(ans,tmp)
print(ans)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

total_costs = {}
if( len(set(A)) == 1 ):
    print((0))
else:
    for i in range(-100, 101):
        cost = 0
        for a in A:
            cost += (a - i)**2
        total_costs[i] = cost
    print((min(total_costs.values())))

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))

total_costs = {}
if( len(set(A)) == 1 ):
    print((0))
else:
    for i in range(-100, 101):
        cost = 0
        for a in A:
            cost += (a - i)*(a - i)
        total_costs[i] = cost
    print((min(total_costs.values())))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

mn = 10**9
for j in range(min(A), max(A)+1):
  cost = 0
  for i in range(N):
    cost += (A[i]-j)**2
  mn = min(cost, mn)
print(mn)

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))

ans = float('INF')
for i in range(min(a), max(a)+1):
    cost = 0
    for aa in a:
        cost += (i - aa)**2
    if cost < ans :
        ans = cost
print(ans)
# Original solution
n = int(eval(input()))
A = list(map(int, input().split()))
ans = 10**10
for i in range(-100, 101):
    t = 0
    for j in A:
        t += (j-i)**2
    if t < ans:
        ans = t
print(ans)

# Optimized solution
n = int(eval(input()))
A = list(map(int, input().split()))
avg = sum(A)//n
avg2 = sum(A)//n + 1
ans = 0
ans2 = 0
for i in A:
    ans += (i-avg)**2
    ans2 += (i-avg2)**2
print((min(ans, ans2)))
# Original solution
n=int(eval(input()))

t = list(map(int,input().split()))

t.sort()

ans = 100000000000000

for i in range(t[0],t[-1]+1):
    memo = 0
    for j in t:
        memo += (i-j)**2
    ans = min(memo, ans)
print(ans)    


# Optimized solution
n=int(eval(input()))

t = list(map(int,input().split()))

ans = 10000000000

for i in range(-100, 101):
    memo = 0
    for j in t:
        memo += (i-j)**2
    ans = min(ans, memo)
print(ans)
# Original solution
def resolve():
	n = int(eval(input()))
	a = list(map(int, input().split()))
	ans = 100**6
	for i in range(-100, 101):
		tmp = 0
		for j in a:
			if i == j:
				continue
			tmp += (j - i)**2
		if tmp < ans:
			ans = tmp
	print(ans)
resolve()

# Optimized solution
def resolve():
	n = int(eval(input()))
	a = list(map(int, input().split()))
	ans = 10000000
	for i in range(-100, 101):
		s = 0
		for j in a:
			s += (i-j)**2
		if ans > s:
			ans = s
	print(ans)
resolve()
# Original solution
from math import ceil

n = int(eval(input()))
numeros = [int(x) for x in input().split()]
saida = 2000000000000000

for i in range(min(numeros), max(numeros)+1):
	valor = 0
	for j in numeros:
		valor += (j-i)**2
	
	saida = min(valor, saida)

print(saida)




# Optimized solution
import sys

n = int(eval(input()))
numeros = [int(x) for x in input().split()]
saida = sys.maxsize

for i in range(min(numeros), max(numeros)+1):
	valor = 0
	for j in numeros:
		valor += (j-i)**2
	
	saida = min(valor, saida)

print(saida)
# Original solution
N = int(eval(input()))
a = list(map(int, input().split()))


def get_cost(now, target):
    return (now - target) * (now - target)


ans = 10000000
for i in range(min(a), max(a) + 1):
    cost_sum = 0
    for j in a:
        cost_sum += get_cost(j, i)
    if cost_sum < ans:
        ans = cost_sum
print(ans)


# Optimized solution
N = int(eval(input()))
a = list(map(int, input().split()))

mean = int(round(sum(a) / len(a)))

ans = 0
for i in range(len(a)):
    ans += (a[i] - mean) ** 2
print(ans)
# Original solution
import sys
input = sys.stdin.readline

def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    a=LI()
    
    ans=10**10
    for t in range(-100,101,1):
        temp=0
        for i in range(N):
            temp+=(t-a[i])**2
        ans=min(ans,temp)
        
    print(ans)

main()


# Optimized solution
import sys
input = sys.stdin.readline

def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    a=LI()
    ave1=sum(a)//N
    
    ans=[0,0]
    for i in range(N):
        ans[0]+=(ave1-a[i])**2
        ans[1]+=(ave1-a[i]+1)**2
    print((min(ans)))
    

main()
# Original solution
N = int(eval(input()))
a = sorted(map(int, input().split()))
cost = 10**9

for y in range(a[0], a[-1]+1):
    cost = min(cost, sum([(x-y)**2 for x in a]))
print(cost)

# Optimized solution
N = int(eval(input()))
A = [int(i) for i in input().split()]
che1 = sum(A)//N
che2 = sum(A)//N + 1
ans1 = 0
ans2 = 0

for i in A:
    ans1 += (i-che1)**2
    ans2 += (i-che2)**2
    
print((min(ans1, ans2)))
# Original solution
n = int(eval(input()))
x = list(map(int,input().split()))
y = round(sum(x)/n)
g = 0
for i in x:
    g += (i-y)**2
print(g)

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
h = round(sum(a)/n)
g = 0
for i in a:
    g += abs(h-i)**2
print(g)
# Original solution
mini=10**29 
n=int(eval(input()))
l=[int(i) for i in input().split()]
for i in range(min(l)-19,max(l)+3):
    sm=0  
    for j in l:
        sm+=(i-j)*(i-j)
    mini=min(mini,sm)
print(mini)

# Optimized solution
mini=10**29 
n=int(eval(input()))
l=[int(i) for i in input().split()]
i = round(sum(l) / n )
for z in range(1):
    sm=0  
    for j in l:
        sm+=(i-j)*(i-j)
    mini=min(mini,sm)
print(mini)
# Original solution
N=int(eval(input()))
*A,=list(map(int,input().split()))

mx=max(A)
mn=min(A)

ans=float('inf')
for i in range(mn,mx+1):
    ans=min(ans, sum([(k-i)**2 for k in A]))
print(ans)

# Optimized solution
N=eval(input())
*A,=list(map(int,input().split()))

a=float('inf')
for i in range(min(A),max(A)+1):a=min(a, sum([(k-i)**2 for k in A]))
print(a)
# Original solution
from statistics  import mean

def main():
    n = int(eval(input()))
    a = list(map(int,input().split()))

    ave = mean(a)
    ave = round(ave)

    ans =0
    for i in a:
        ans += (i-ave)**2

    print(ans)


if __name__ == "__main__":
        main()


# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))

ave = round(sum(a)/n)

ans = 0
for i in a:
    ans += (ave - i)**2

print(ans)
# Original solution
N = int(eval(input()))
a = [int(i) for i in input().split()]

li_ans = []
ans = 0

for j in range(min(a), max(a)):
    for k in a:
        ans += abs(k - j) ** 2
    else:
        li_ans.append(ans)
        ans = 0

if len(li_ans) == 0:
    print((0))
else:
    print((min(li_ans)))

# Optimized solution
N = int(eval(input()))
a = [int(i) for i in input().split()]

li_ans = []
ans = 0

for j in range(min(a), max(a)):
    for k in a:
        ans += abs(k - j) ** 2
    
    li_ans.append(ans)
    ans = 0

if len(li_ans) == 0:
    print((0))
else:
    print((min(li_ans)))
# Original solution
def main():
    N = int(eval(input()))
    A = list(map(int, input().split()))

    m = min(A)
    M = max(A)

    Result = 100000000

    for i in range(m, M+1):
        Result_tmp = 0
        for a in A:
            Result_tmp += (a - i) * (a - i)
        Result = min(Result_tmp, Result)
    print(Result)


if __name__ == "__main__":
    main()


# Optimized solution
def main():
    N = int(eval(input()))
    A = list(map(int, input().split()))

    m = min(A)
    M = max(A)

    Result = 0
    for a in A:
        Result += (a-m) * (a-m)

    for i in range(m+1, M+1):
        Result_tmp = 0
        for a in A:
            Result_tmp += (a - i) * (a - i)
        Result = min(Result_tmp, Result)
    print(Result)


if __name__ == "__main__":
    main()
# Original solution
N = int(eval(input()))
a = list(map(int, input().split()))

min = None
for y in range(-100, 101):
    sum = 0
    for x in a:
        sum += abs(x - y) ** 2
    if min is None or min > sum:
        min = sum

print(min)


# Optimized solution
# https://atcoder.jp/contests/abc043/tasks/arc059_a
n = int(eval(input()))
a = list(map(int, input().split()))
min = float('inf')
for y in range(-100, 101):
    sum = 0
    for x in a:
        sum += (x - y) ** 2
    if min > sum:
        min = sum

print(min)
# Original solution
N=int(eval(input()))
li=list(map(int,input().split()))
ave1=sum(li)//N
ave2=sum(li)//N+1
ave3=sum(li)//N-1
ans1=0
ans2=0
ans3=0
for n in range(len(li)):
  ans1+=(li[n]-ave1)**2
  ans2+=(li[n]-ave2)**2
  ans3+=(li[n]-ave3)**2
print((min(ans1,ans2,ans3)))

# Optimized solution
N=int(eval(input()))
li=list(map(int,input().split()))
ave1=sum(li)//N
ave2=sum(li)//N+1
ans1=0
ans2=0
for n in range(len(li)):
  ans1+=(li[n]-ave1)**2
  ans2+=(li[n]-ave2)**2
print((min(ans1,ans2)))
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))
cost = []

for n in range(min(A),max(A)+1):
  cost.append(sum([(a-n)**2 for a in A]))

print((min(cost)))

# Optimized solution
N = int(eval(input()))
A = list(map(int,input().split()))
m = round(sum(A)/N)
print((sum([(a-m)**2 for a in A])))
# Original solution
N = int(eval(input()))
src = list(map(int,input().split()))

ans = 10**9
for i in range(-100,101):
    tmp = sum([(a-i)**2 for a in src])
    ans = min(ans, tmp)
print(ans)


# Optimized solution
N = int(eval(input()))
src = list(map(int,input().split()))

ans = float('inf')
for n in range(-100,101):
    tmp = sum([(n-a)**2 for a in src])
    ans = min(ans, tmp)

print(ans)
# Original solution
INF = int(1e9 + 7)


def main():
    N, *an = list(map(int, open(0).read().split()))
    ans = INF
    for i in range(min(an), max(an) + 1):
        tmp = 0
        for ai in an:
            tmp += (ai - i) ** 2
        ans = min(ans, tmp)
    print(ans)
    return


main()


# Optimized solution
def main():
    N, *an = list(map(int, open(0).read().split()))
    print((min(sum((ai - (sum(an) // N)) ** 2 for ai in an),
              sum((ai + (-sum(an) // N)) ** 2 for ai in an))))
    return


main()
# Original solution
import statistics

am = int(eval(input()))
n_l = list(map(int, input().split(' ')))

m = round(statistics.mean(n_l))

S = 0
for a in range(am):
    S += (n_l[a] - m)**2

print((int(S)))

# Optimized solution
am = int(eval(input()))
n_l = list(map(int, input().split(' ')))

m = round(sum(n_l)/len(n_l))

S = 0
for a in range(am):
    S += (n_l[a] - m)**2

print((int(S)))
# Original solution
n = int(eval(input()))
a=list(map(int,input().split()))

#print(a)

amin = min(a)
amax = max(a)
min_sum=10**8
for x in range(amin,amax+1):
    sum_for_x = sum([(y-x)**2 for y in a])
    if sum_for_x < min_sum:
        min_sum = sum_for_x

print(min_sum)   

# Optimized solution
# -*- coding: utf-8 -*-
"""
Created on Sat Aug  4 18:19:03 2018

@author: maezawa
"""

n = int(eval(input()))
a = list(map(int, input().split()))

mean_a = round(sum(a)/n)

ans = 0
for i in a:
    ans += (i-mean_a)**2

print(ans)
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
res = float('inf')
for i in range(-100,101):
	tmp = 0
	for j in a:
		tmp += (j-i)**2
	res = min(res,tmp)
print(res)

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
res = float('inf')
for i in range(-100,101):
    tmp = 0
    for j in a:
        tmp += (i-j)**2
    res = min(res,tmp)
print(res)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))

cost = [0] * 201
for i in range(201):
    for j in a:
        cost[i] += ((i - 100) - j) ** 2

print((min(cost)))

# Optimized solution
n = int(eval(input()))
A = [int(i) for i in input().split()]
ave = round(sum(A) / n)
ans = 0
for x in A:
    ans += (x-ave)**2
print(ans)
# Original solution
N=int(eval(input()))
A=list(map(int,input().split()))
st=int(sum(A)/len(A))
go=st+1
ans=10**9+1
for i in range(st,go+1):
  val=0
  for a in A:
    val+=(a-i)**2
  ans=min(ans,val)
print(ans)

# Optimized solution
N=int(eval(input()))
A=list(map(int,input().split()))
ans=10**9+1
for i in (0,1):
  val=0
  for a in A:
    val+=(a-int(sum(A)/len(A))-i)**2
  ans=min(ans,val)
print(ans)
# Original solution
def c_be_together(N, A):
    a_sum = sum(A)
    option = (a_sum // N, (a_sum + N - 1) // N)
    ans = float('inf')
    for opt in option:
        ans = min(ans, sum([(a - opt)**2 for a in A]))
    return ans

N = int(eval(input()))
A = [int(i) for i in input().split()]
print((c_be_together(N, A)))

# Optimized solution
def c_be_together(N, A):
    a_sum = sum(A)
    option = (a_sum // N, (a_sum + N - 1) // N)  # 平均値の小数切り捨て|切り上げ
    ans = min(sum([(a - opt)**2 for a in A]) for opt in option)  # コストを計算
    return ans

N = int(eval(input()))
A = [int(i) for i in input().split()]
print((c_be_together(N, A)))
# Original solution
n = eval(input())
a = list(map(int, input().split()))
ans = list()
for i in range(min(a), max(a)+1):
    cost = 0
    for num in a:
        cost += (num - i)**2
    ans.append(cost)
print((min(ans)))

# Optimized solution
def cost(x):
    cost = (x - ave)**2
    return cost


n = eval(input())
a = list(map(int, input().split()))
ave = round(sum(a)/int(n))
print((sum(list(map(cost, a)))))
# Original solution
import math

n = int(eval(input()))
a = math.sqrt(n)

if n % a == 0.0:
    b = int(math.log10(a)) + 1
    print(b)
else:
    a = int(a)
    while n % a != 0:
        a = a + 1
    b = int(math.log10(a)) + 1
    print(b)

# Optimized solution
import math


n = int(eval(input()))
a = math.sqrt(n)

if n % a == 0.0:
    b = int(math.log10(a)) + 1
    print(b)
else:
    a = int(a)
    for i in range(a, 0, -1):
    	if n % i == 0:
    		a = n / i
    		break
    b = int(math.log10(a)) + 1
    print(b)
# Original solution
import math

def cal(N):
    num=math.ceil(N**0.5)
    num=int(num)
    for i in range(num,N+1):
       if N%i==0:
           x=len(str(i))
           break
    return x

print((cal(int(eval(input())))))

# Optimized solution
def cal(N):
    num=(N**0.5)//1
    num=int(num)
    for i in range(num,0,-1):
       if N%i==0:
           k=int(N/i)
           x=len(str(k))
           break
    return x

print((cal(int(eval(input())))))
# Original solution
import math

num = int(eval(input()))
num_sqrt = int(math.sqrt(num))

A = num_sqrt
while num % A != 0:
    A += 1
B = int(num / A)
A, B = str(A), str(B)
ans = max(len(A), len(B))
print(ans)


# Optimized solution
import math

num = int(eval(input()))
num_sqrt = int(math.sqrt(num))

ans = 11
for A in range(1, num_sqrt+1):
    if num % A == 0:
        B = int(num / A)
        A, B = str(A), str(B)
        now_ans = max(len(A), len(B))
        ans = min(ans, now_ans)
print(ans)
# Original solution
N=int(eval(input()))
result=0
count = 1
while count*count <= N:
  if N % count == 0:
    result=count
  count+=1
print((len(str(N//result))))

# Optimized solution
n,r=int(eval(input())),1e9
for i in range(1,int(n**.5)+1):
  if n%i==0: r=min(r,max(len(str(i)),len(str(n//i))))
print(r)
# Original solution
n,r=int(eval(input())),1e9
for i in range(1,int(n**.5)+1):
  if n%i==0: r=min(r,max(len(str(i)),len(str(n//i))))
print(r)

# Optimized solution
n,r=int(eval(input())),1e9
for i in range(1,int(n**.5)+1):
  if n%i==0: r=min(r,len(str(n//i)))
print(r)
# Original solution
n,r=int(eval(input())),1e9
for i in range(1,int(n**.5)+1):
  if n%i==0:r=min(r,len(str(n//i)))
print(r)

# Optimized solution
n,r=int(eval(input())),1e9
print((min([len(str(n//i)) for i in range(1,int(n**.5)+1) if n%i==0])))
# Original solution
def digit(n):
    ans = 0
    while n > 0:
        ans += 1
        n //= 10
    return ans

N = int(eval(input()))

check = 100
for i in range(1, 1+N):
    if N % i != 0:
        continue
    if N // i < i:
        break
    j = N // i
    f = max(digit(i), digit(j))
    check = min(check, f)

print(check)

# Optimized solution
def digit(n):
    ans = 0
    while n > 0:
        ans += 1
        n //= 10
    return ans

N = int(eval(input()))

check = 100
for i in range(1, int(1e6)):
    if N % i != 0:
        continue
    if N // i < i:
        break
    j = N // i
    f = max(digit(i), digit(j))
    check = min(check, f)

print(check)
# Original solution
import math
n=int(eval(input()))
x=1
while(x<=n**0.5):
  if(n%x!=0):
    x+=1
  else:
    mins=int(math.log10(n//x))
    x+=1
    
print((mins+1))

# Optimized solution
import math
import sys
n=int(eval(input()))
mi=int(math.log10(n))
nb=n
m=1
for i in range(1,int(nb**0.5)+2):
  if(n%i==0):
    mi=min(mi,max(int(math.log10(n/i)),int(math.log10(i))))
print((mi+1))
# Original solution
import math
number = int(eval(input()))
ruijou = int(math.sqrt(number))
check = 0
count = 0
result =100000000000

for i in range(1,int(ruijou)+1):
    if number % i == 0:
        check = int(number / i)
        while not check == 0:
            check = int(check / 10)
            count += 1
        if count < result :
            result = count
    count = 0
print(result)

# Optimized solution
n = int(eval(input()))
a,b,c = 0,0,float("Inf")
for i in range(1,int(n**0.5)+1):
    if n % i == 0:
        a = max(i,n//i)
        b = 0
        while not a == 0:
            a //= 10
            b += 1
        c = min(c,b)
print(c)
# Original solution
n = int(eval(input()))
mul_list = []
for i in range(1, n+1):
    if n % i == 0:
        if i <= n / i:
            mul = [i, n/i]
            mul_list.append(mul)
        else:
            break
length = 10000000000000
result = 0
for line in mul_list:
    dif = len(str(line[1]))-len(str(line[0]))
    if dif < length:
       result = len(str(int(line[1])))
print(result)    

# Optimized solution
n = int(eval(input()))
mul_list = []
for i in range(1, n+1):
    if i <= n / i:
        if n % i == 0:
            mul = [i, n/i]
            mul_list.append(mul)
    else:
        break
length = 10000000000000
result = 0
for line in mul_list:
    dif = len(str(line[1]))-len(str(line[0]))
    if dif < length:
       result = len(str(int(line[1])))
print(result)