You are given an array $a_{1}, a_{2}, \ldots, a_{n}$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.

In other words, at most one time you can choose two integers $l$ and $r$ ($1 \leq l \leq r \leq n$) and delete integers $a_l, a_{l+1}, \ldots, a_r$ from the array. Remaining elements should be pairwise distinct. 

Find the minimum size of the subsegment you need to remove to make all remaining elements distinct.


-----Input-----

The first line of the input contains a single integer $n$ ($1 \le n \le 2000$) — the number of elements in the given array.

The next line contains $n$ spaced integers $a_{1}, a_{2}, \ldots, a_{n}$ ($1 \le a_{i} \le 10^{9}$) — the elements of the array. 


-----Output-----

Print a single integer — the minimum size of the subsegment you need to remove to make all elements of the array pairwise distinct. If no subsegment needs to be removed, print $0$.


-----Examples-----
Input
3
1 2 3

Output
0

Input
4
1 1 2 2

Output
2

Input
5
1 4 1 4 9

Output
2



-----Note-----

In the first example all the elements are already distinct, therefore no subsegment needs to be removed.

In the second example you can remove the subsegment from index $2$ to $3$.

In the third example you can remove the subsegments from index $1$ to $2$, or from index $2$ to $3$, or from index $3$ to $4$.

Difficulty: competition

Starter code:

Solutions:
def main():
    import sys
    input = sys.stdin.readline
    
    n = int(input())
    arr = list(map(int, input().split()))
    
    dct = {}
    for x in arr:
        dct[x] = 0
    
    i = 0
    while i != n and dct[arr[i]] == 0:
        dct[arr[i]] = 1
        i += 1
    
    if i == n:
        print(0)
        return 0
    
    j = n - 1
    while dct[arr[j]] == 0:
        dct[arr[j]] = 1
        j -= 1
    
    ans = j - i + 1
    
    for k in range(i - 1, -1, -1):
        dct[arr[k]] -= 1
        while dct[arr[j]] == 0:
            dct[arr[j]] = 1
            j -= 1
        ans = min(ans, j - (k - 1))
    
    print(ans)
    
    return 0

main()

n = int(input())
a = list(map(int, input().split()))
s, d = {}, {}
for q in range(n):
    s[a[q]] = q
    d[a[q]] = d.get(a[q], 0)+1
q2, ans = 0, n-1
for q1 in d:
    while d[q1] > 1:
        d[a[q2]] -= 1
        q2 += 1
f = set()
for q in range(n):
    ans = min(ans, q2-q)
    if a[q] in f:
        break
    f.add(a[q])
    q2 = max(q2, s[a[q]]+1, q+1)
print(ans)


import sys

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

d = dict()

for elem in a:
    d[elem] = d.get(elem, 0) + 1

not_uniq = 0
for elem in d:
    if d[elem] > 1:
        not_uniq += 1

if not_uniq == 0:
    print(0)
    return

ans = 10 ** 9
left = 0
right = -1

while True:
    if not_uniq == 0:
        ans = min(ans, right - left + 1)
    if not_uniq > 0:
        right += 1
        if right >= n:
            break
        elem = a[right]
        d[elem] -= 1
        if d[elem] == 1:
            not_uniq -= 1
    else:
        elem = a[left]
        d[elem] += 1
        if d[elem] == 2:
            not_uniq += 1
        left += 1

print(ans)


        
    


n = int(input())
a = [int(x) for x in input().split()]

from collections import defaultdict as dd
d = dd(int)

for i in a:
    d[i] += 1

cnt, ans = 0, 10000000
for i in d:
    if d[i] >= 2:
        cnt += 1

if cnt == 0:
    print(0)
else:
    for i in range(n):
        d2 = dd(int)
        ct = 0
        for j in range(i, n):
            d2[a[j]] += 1

            if d2[a[j]] == d[a[j]] - 1 and d[a[j]]  >= 2:
                ct += 1
                
            #print(j, i, ct, d2[3])
            if ct == cnt:
                ans = min(ans, abs(j - i + 1))
                
    print(ans)


import sys
import copy
input = sys.stdin.readline

n=int(input())
A=list(map(int,input().split()))

from collections import Counter

C=Counter(A)
for a in A:
    if C[a]<=1:
        del C[a]



if not(C):
    print(0)
    return

ANS=n-1

for i in range(n):
    D=copy.deepcopy(C)

    for j in range(i,n):
        if D[A[j]]>=1:
            D[A[j]]-=1

        if D[A[j]]==1:
            del D[A[j]]

        if not(D):
            ANS=min(ANS,j-i+1)
            break

    #print(i,j,D,ANS)

print(ANS)
            


import math
from collections import defaultdict


def try_solve(x, d):
    occ = defaultdict(lambda: 0)
    for i in range(d, len(x)):
        occ[x[i]] += 1
    multi = 0
    for k, v in list(occ.items()):
        if v > 1:
            multi += 1

    if multi == 0:
        return True

    if d == 0:
        return False

    for i in range(len(x) - d):
        occ[x[i]] += 1
        if occ[x[i]] == 2: multi += 1
        occ[x[i + d]] -= 1
        if occ[x[i + d]] == 1: multi -= 1
        if multi == 0:
            return True

    return False


def main():
    n = int(input())
    x = [int(x) for x in input().split()]

    for i in range(n - 1):
        if try_solve(x, i):
            print(i)
            return

    print(n - 1)


def __starting_point():
    main()


__starting_point()

'''input
4
1 1 2 2
'''
from sys import stdin
from copy import deepcopy


def get_dict(arr, n):
	mydict = dict()
	for i in range(n):
		if arr[i] in mydict:
			mydict[arr[i]] += 1
		else:
			mydict[arr[i]] = 1

	more = 0
	for i in mydict:
		if mydict[i] > 1:
			more += 1
	return more, mydict


# main starts
n = int(stdin.readline().strip())
arr = list(map(int, stdin.readline().split()))
ans = float('inf')
more, mydict = get_dict(arr, n)
if more == 0:
	ans = 0
	print(ans)
	return

for i in range(n):
	t = more
	tdict = deepcopy(mydict)
	for j in range(i, n):
		tdict[arr[j]] -= 1
		if tdict[arr[j]] == 1:
			t -= 1
		if t == 0:
			ans = min(ans,  abs(i - j) + 1)


print(ans)

n = int(input())

a = list(map(int,input().split()))
min1 = n + 1
myset = set()
for i in range(n):
    temp = myset.copy()
    min1 = min(min1, n - i)
    for j in range(n-1, i-1, -1):
    	if(a[j] in temp):
    		break
    	temp.add(a[j])
    	min1 = min(min1, j - i)
    if(a[i] in myset):
        break
    myset.add(a[i])
    # print(myset, min1)
	
print(min1)

'''n=int(input())
a=[int(i) for i in input().split()]
st = set()
pre=[]
for i in range(len(a)):
    st.add(a[i])
    pre.append(len(st))

stn=set()
suf=[]
for i in range(len(a)-1,-1,-1):
    stn.add(a[i])
    suf.append(len(stn))
suf = suf[::-1]
suf = suf + [0]
pre = [0]+pre
fuf = suf+[0]

ans=10**9
for i in range(len(a)):
    for j in range(i,len(a)):
        left=i
        right=j
        tot = (i) + (n-j-1)
        if(pre[i]+suf[j+1]==tot):
            print(i,j,left,right,tot,pre[i],suf[j])
            ans = min(ans,j-i+1)
if(ans==10**9):
    print(0)
else:
    print(ans)'''
from collections import defaultdict as dd

def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    d = dd(int)

    for i in a:
        d[i] += 1

    cnt=0
    ans=10**9
    for i in d:
        if d[i] >= 2:
            cnt += 1

    if cnt == 0:
        print(0)
    else:
        for i in range(n):
            d2 = dd(int)
            ct = 0
            for j in range(i, n):
                d2[a[j]] += 1

                if d2[a[j]] == d[a[j]] - 1 and d[a[j]]  >= 2:
                    ct += 1

                if ct == cnt:
                    ans = min(ans, abs(j - i + 1))
                    
        print(ans)


main()


n = int(input())
A = [int(x) for x in input().split()]

from collections import defaultdict as dd


hsh = dd(int)
for i in range(n):
    hsh[A[i]] += 1

cnt = 0
ans = 10000000

for i in hsh:
    if hsh[i] >= 2:
        cnt += 1
if len(set(A)) == n:
    print(0)
else:
    for i in range(n):
        hsh2 = dd(int)
        ct = 0
        for j in range(i, n):
            hsh2[A[j]] += 1
            if hsh2[A[j]] == hsh[A[j]] - 1 and hsh[A[j]]  >= 2:
                ct += 1
            if ct == cnt:
                ans = min(ans, abs(j - i + 1))
                
    print(ans)


from collections import defaultdict


def can_remove(a, n):
    nums = defaultdict(lambda: 0)

    for i in range(n, len(a)):
        nums[a[i]] += 1

    if all([x<=1 for x in  list(nums.values())]):
        return True

    for remove_num in range(n, len(a)):
        nums[a[remove_num]] -= 1
        nums[a[remove_num - n]] += 1
        if all([x <= 1 for x in list(nums.values())]):
            return True

    return False



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

impossible = -1
possible = len(a) - 1

while possible - impossible > 1:
    m = (possible + impossible) // 2
    if can_remove(a, m):
        possible = m
    else:
        impossible = m

print(possible)





import collections
def __starting_point():
    N = int(input())
    A = [int(a) for a in input().split(" ")]
    C = collections.Counter(A)
    n_duplicate = 0
    for k, v in list(C.items()):
        if v > 1:
            n_duplicate += v - 1
    if n_duplicate == 0:
        print("0")
    else:
        ans = N
        for i in range(0, N - 1):
            T = collections.Counter(A)
            t_duplicate = n_duplicate
            for j in range(i, min(N, i + ans)):
                T[A[j]] -= 1
                if T[A[j]] >= 1:
                    t_duplicate -= 1
                if t_duplicate == 0:
                    ans = j + 1 - i
                    break
        print(str(ans))



__starting_point()

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

    ans = n
    for l in range(0, n + 1):
        s = set(a[:l])
        if len(s) < l:
            break

        # print(l, s)

        r = n - 1
        while r >= l and a[r] not in s:
            s.add(a[r])
            r -= 1

        # print(r, s)
        ans = min(ans, r - l + 1)
        # print()

    print(ans)


main()


def f(m):
    b = {}
    for i in a[m:]:
        if i in b:
            b[i] += 1
        else:
            b[i] = 1
    #print(m,b)
    k = 0
    for i in b:
        if b[i] > 1:
            k += 1
    if k == 0:
        return True
    for i in range(n-m):
        b[a[i+m]] -= 1
        if b[a[i+m]] == 1:
            k -= 1
        if a[i] in b:
            b[a[i]] += 1
            if b[a[i]] == 2:
                k += 1
        else:
            b[a[i]] = 1
        if k == 0:
            return True
    return False

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

l = 0
r = n
while r-l > 1:
    m = (r+l)//2
    if f(m):
        r = m
    else:
        l = m
if f(l):
    r = l
print(r)


import sys


def get_sn():
    return int(input())

def get_n():
    return list(map(int, input().split()))

def get_ln():
    return list(get_n())

def cond(x, a, n):
    for i in range(n - x + 1):
        if len(set(a[:i] + a[i + x:])) == n - x:
            return True
    return False

def solve(a, n):
    l, r = -1, n + 1
    while r - l > 1:
        m = (r + l) // 2
        if cond(m, a, n):
            r = m
        else:
            l = m
    return r

def main():
    n = get_sn()
    arr = get_ln()
    print(solve(arr, n))

main()


import sys
input = lambda: sys.stdin.readline().strip()

n = int(input())
ls = list(map(int, input().split()))
d = [{}]
works = {}
for i in range(n):
    works[i] = True
for i in range(n):
    d.append(dict(d[-1]))
    try: d[-1][ls[i]]+=1; works[i] = False
    except: d[-1][ls[i]] = 1
m = n
for l in range(n):
    for r in range(n-1, l-1, -1):
        try:
            d[l][ls[r]]+=0
            break
        except:
            d[l][ls[r]] = 1
            pass
    if works[l]:
        m = min(m, r-l+1)
    else:
        m = min(m, r-l+1)
        break
if len(set(ls))==n: print(0)
else: print(m)


n=int(input())
a=list(map(int,input().split()))
k=set(a)
m=len(k)
if n == m:
    print(0)
else:
    ans=9999999999999999999999999999999999999999999999999999999999999999
    for i in range(n):
        mp={}
        for j in range(n):
            if a[j] in mp:
                mp[a[j]] += 1
            else:
                mp[a[j]]=1
        for j in range(i,n):
            mp[a[j]] -= 1
            if mp[a[j]]==0:
                    mp.pop(a[j])
            p=len(mp)
            if p == n-j+i-1:
                ans=min(ans,j-i+1);     
                break
            
    print(ans)


from collections import defaultdict
def KKK():
    n = int(input())
    d = defaultdict(int)
    a = list(map(int, input().split()))
    se = set()
    for i in range(len(a)):
        d[a[i]] += 1
        se.add(a[i])

    s = 0
    while se:
        s += d[se.pop()] - 1


    minLen = 3000
    for i in range(len(a)):
        r = s
        newd = d.copy()
        for j in range(i, len(a)):
            if r == 0:
                minLen = min(j - i, minLen)
            if newd[a[j]] > 1:
                newd[a[j]] -= 1
                r -= 1
        if r == 0:
            minLen = min(len(a) - i, minLen)
    print(minLen)
KKK()

# alpha = "abcdefghijklmnopqrstuvwxyz"
# prime = 998244353 
# INF = 1000000000000000000000

# from sys import stdout
# from heapq import heappush, heappop
from collections import defaultdict
# from collections import deque  

# from math import sqrt    
# from math import gcd
# from math import log2

t = 1#int(input())

for test in range(t):
    n = int(input())
    a = list(map(int, input().split()))
    D = defaultdict(int)
    ind1 = 0
    ind2 = -1
    for i in a:
        D[i]+=1
    count = 0
    seta = list(set(a))
    for i in seta:
        if D[i]>1:
            count+=1
    if count == 0:
        print(0)
        return
    tmp_count = 0
    ans = n
    while True:
        # print("check", tmp_count, count, ind2)
        if tmp_count<count:
            ind2+=1
            if ind2==n:
                break
            D[a[ind2]]-=1
            if D[a[ind2]]==1:
                tmp_count+=1
        elif tmp_count==count:
            ans = min(ind2-ind1+1, ans)
            D[a[ind1]]+=1
            if D[a[ind1]]==2:
                tmp_count-=1
            ind1+=1
    print(ans)






from sys import stdin, stdout
input = stdin.readline
print = stdout.write


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


def solve(n, a):
    l = -1
    s = set()
    while l + 1 < n and a[l + 1] not in s:
        s.add(a[l + 1])
        l += 1

    r = n
    while r - 1 >= 0 and a[r - 1] not in s:
        s.add(a[r - 1])
        r -= 1

    res = l + 1 + (n - r)
    while l >= 0:
        s.remove(a[l])
        l -= 1
        while r - 1 >= 0 and a[r - 1] not in s:
            s.add(a[r-1])
            r -= 1
        res = max(res, l + 1 + n - r)
    return n - res

print(str(solve(n, a)))


n = int(input())
a = [int(x) for x in input().split()]
mp = {}
rep = 0

for i in range(n):
  if a[i] in mp:
    mp[a[i]] += 1
    rep+=1
  else:
    mp[a[i]] = 1

ans = 1000000
if rep == 0:
  print(0)
else:
  for i in range(n):
    z = []
    flag = 0
    for j in range(i,n):
      if mp[a[j]]>1:
        z.append(a[j])
        mp[a[j]]-=1
        rep-=1
      if rep == 0:
        ans = min(ans,j - i + 1)
        break
    rep+=len(z)
    for i in z:
      mp[i]+=1
  print(ans)





n = int(input())
ai = list(map(int,input().split()))
ar = {}
num = 1
for i in range(n):
    try:
        ar[ai[i]] += 1
        num = i
        break
    except:
        ar[ai[i]] = 1
ans = num
if ans == n :
    print(0)
else:
    for i in range(num-1,-2,-1):
        ar3 = {}
        for j in range(i+1):
            ar3[ai[j]] = 1
        for j in range(n-1,-1,-1):
            try:
                ar3[ai[j]] += 1
                ans = max(ans, i+1 + n-1-j )
                break
            except:
                ar3[ai[j]] = 1
    print(n - ans)


''' بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ '''
#codeforces1208B_live
from collections import Counter
gi = lambda : list(map(int,input().split()))
n, = gi()
l = gi()
occ = Counter(l)
mid = 0
ans = n
rep = n - len(occ)
def f(x):
	oc = Counter(l)
	for k in range(x):
		oc[l[k]] -= 1
	s = set(oc.values())
	if s == {1} or s == {1, 0}:
		return 1
	for k in range(x, n):
		oc[l[k]] -= 1
		oc[l[k - x]] += 1
		s = set(oc.values())
		if s == {1} or s == {1, 0}:
			return 1
	return 0
lo, hi = 0, n
while lo <= hi:
	mid = (lo + hi) // 2
	if f(mid):
		ans = min(ans, mid)
		hi = mid - 1
	else:
		lo = mid + 1
print(ans)

''' CODED WITH LOVE BY SATYAM KUMAR '''

from sys import stdin, stdout
import heapq
import cProfile, math
from collections import Counter, defaultdict, deque
from bisect import bisect_left, bisect, bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction
import sys, threading
import operator as op
from functools import reduce
import sys

sys.setrecursionlimit(10 ** 6)  # max depth of recursion
threading.stack_size(2 ** 27)  # new thread will get stack of such size
fac_warm_up = False
printHeap = str()
memory_constrained = False
P = 10 ** 9 + 7


class MergeFind:
    def __init__(self, n):
        self.parent = list(range(n))
        self.size = [1] * n
        self.num_sets = n
        self.lista = [[_] for _ in range(n)]

    def find(self, a):
        to_update = []
        while a != self.parent[a]:
            to_update.append(a)
            a = self.parent[a]
        for b in to_update:
            self.parent[b] = a
        return self.parent[a]

    def merge(self, a, b):
        a = self.find(a)
        b = self.find(b)
        if a == b:
            return
        if self.size[a] < self.size[b]:
            a, b = b, a
        self.num_sets -= 1
        self.parent[b] = a
        self.size[a] += self.size[b]
        self.lista[a] += self.lista[b]

    def set_size(self, a):
        return self.size[self.find(a)]

    def __len__(self):
        return self.num_sets


def display(string_to_print):
    stdout.write(str(string_to_print) + "\n")


def prime_factors(n):  # n**0.5 complex
    factors = dict()
    for i in range(2, math.ceil(math.sqrt(n)) + 1):
        while n % i == 0:
            if i in factors:
                factors[i] += 1
            else:
                factors[i] = 1
            n = n // i
    if n > 2:
        factors[n] = 1
    return (factors)


def all_factors(n):
    return set(reduce(list.__add__,
                      ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))


def fibonacci_modP(n, MOD):
    if n < 2: return 1
    return (cached_fn(fibonacci_modP, (n + 1) // 2, MOD) * cached_fn(fibonacci_modP, n // 2, MOD) + cached_fn(
        fibonacci_modP, (n - 1) // 2, MOD) * cached_fn(fibonacci_modP, (n - 2) // 2, MOD)) % MOD


def factorial_modP_Wilson(n, p):
    if (p <= n):
        return 0
    res = (p - 1)
    for i in range(n + 1, p):
        res = (res * cached_fn(InverseEuler, i, p)) % p
    return res


def binary(n, digits=20):
    b = bin(n)[2:]
    b = '0' * (digits - len(b)) + b
    return b


def is_prime(n):
    """Returns True if n is prime."""
    if n < 4:
        return True
    if n % 2 == 0:
        return False
    if n % 3 == 0:
        return False
    i = 5
    w = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += w
        w = 6 - w
    return True


def generate_primes(n):
    prime = [True for i in range(n + 1)]
    p = 2
    while p * p <= n:
        if prime[p]:
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 1
    return prime


factorial_modP = []


def warm_up_fac(MOD):
    nonlocal factorial_modP, fac_warm_up
    if fac_warm_up: return
    factorial_modP = [1 for _ in range(fac_warm_up_size + 1)]
    for i in range(2, fac_warm_up_size):
        factorial_modP[i] = (factorial_modP[i - 1] * i) % MOD
    fac_warm_up = True


def InverseEuler(n, MOD):
    return pow(n, MOD - 2, MOD)


def nCr(n, r, MOD):
    nonlocal fac_warm_up, factorial_modP
    if not fac_warm_up:
        warm_up_fac(MOD)
        fac_warm_up = True
    return (factorial_modP[n] * (
                (pow(factorial_modP[r], MOD - 2, MOD) * pow(factorial_modP[n - r], MOD - 2, MOD)) % MOD)) % MOD


def test_print(*args):
    if testingMode:
        print(args)


def display_list(list1, sep=" "):
    stdout.write(sep.join(map(str, list1)) + "\n")


def display_2D_list(li):
    for i in li:
        print(i)


def prefix_sum(li):
    sm = 0
    res = []
    for i in li:
        sm += i
        res.append(sm)
    return res


def get_int():
    return int(stdin.readline().strip())


def get_tuple():
    return list(map(int, stdin.readline().split()))


def get_list():
    return list(map(int, stdin.readline().split()))


memory = dict()


def clear_cache():
    nonlocal memory
    memory = dict()


def cached_fn(fn, *args):
    nonlocal memory
    if args in memory:
        return memory[args]
    else:
        result = fn(*args)
        memory[args] = result
        return result


def ncr(n, r):
    return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))


def binary_search(i, li):
    fn = lambda x: li[x] - x // i
    x = -1
    b = len(li)
    while b >= 1:
        while b + x < len(li) and fn(b + x) > 0:  # Change this condition 2 to whatever you like
            x += b
        b = b // 2
    return x


# -------------------------------------------------------------- MAIN PROGRAM


TestCases = False
fac_warm_up_size = 10 ** 5 + 100
optimise_for_recursion = False  # Can not be used clubbed with TestCases WHen using recursive functions, use Python 3


def main():
    n = get_int()
    li = get_list()
    l,r = 0, -1
    cnt = Counter(li)
    for i in range(n):
        st = set()
        if cnt[li[i]]==1: continue
        brk = False
        for j in range(0,i):
            if li[j] in st:
                brk = True
                break
            st.add(li[j])
        if brk: continue
        for j in range(n-1, i-1, -1):
            if li[j] in st:
                break
            st.add(li[j])
        if r-l<0 or r-l>=j-i:
            l,r = i, j
            #print(l,r )
    print(r-l+1)

# --------------------------------------------------------------------- END=


if TestCases:
    for i in range(get_int()):
        main()
else:
    main() if not optimise_for_recursion else threading.Thread(target=main).start()


def check(repeat):
    for key in repeat:
        if(repeat[key]>0):
            return False
    return True




n=int(input())
array=list(map(int,input().split()))
occur=dict()
repeat=dict()
for i in array:
    if(i not in occur):
        occur[i]=1
    else:
        if(i not in repeat):
            repeat[i]=1
        else:
            repeat[i]+=1
if(len(repeat)==0):
    print(0)
else:
    minm=2**31-1
    i=0
    boolean=False
    j=0
    while(i<len(array) and j<len(array)):
        while(boolean==False and j<len(array)):
            if(array[j] in repeat):
                repeat[array[j]]-=1
            j+=1
            if(check(repeat)):
                minm=min(minm,j-i)
                #print("a",i,j)
                boolean=True
            else:
                boolean=False
        while(boolean==True and i<j):
            if(array[i] in repeat):
                repeat[array[i]]+=1
            i+=1
            if(check(repeat)):
                boolean=True
                #print("b",i,j)
                minm=min(minm,j-i)
            else:
                boolean=False
    boolean=check(repeat)
    while(boolean and i<len(array)):
        if(array[i] in repeat):
            repeat[array[i]]+=1
        i+=1
        if(check(repeat)):
            boolean=True
            #print(i,j)
            minm=min("c",minm,j-i)
        else:
            boolean=False
    print(minm)