Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n=int(input())
a=[0]*n
a=list(map(int,input().split()))
a=sorted(a)
ans=0
List=[]
ans+=1
flag=0
List.append(a[0])

for i in range(1,n):
    m=len(List)
    for j in range(m):
        if (a[i]==List[-1]):
            if (flag==0):
                ans-=1
            flag=1
            break
        elif (a[i]%List[j]==0):
            flag=0
            break
        elif(j==m-1):
            List.append(a[i])
            flag=0
            ans+=1
print(ans)

### FIXED CODE ###

n=int(input())
a=[0]*n
a=list(map(int,input().split()))
a=sorted(a)
maxnum=a[-1]
check=[True]*(maxnum+1)
before=0

for x in a:
    if (before==x):
        check[x]=False
        continue
    num=2
    while num*x<=maxnum:
        check[x*num]=False
        num+=1
    before=x

ans=0
for i in a:
    ans+=check[i]
    
print(ans)
### BUGGY CODE ###

n = int(input())
a = [int(input()) for i in range(5)]
count = 0
p = [n, 0, 0, 0, 0, 0]
result = p
while(True):
    if result[5] == n:
        print(count)
        break
    else:
        for i, per in enumerate(p[:-1]):
            if per >= a[i]:
                result[i] -= a[i]
                result[i + 1] += a[i]
            elif per > 0 and per < a[i]:
                result[i] -= per
                result[i + 1] += per
    p = result
    count += 1


### FIXED CODE ###

import math
n = int(input())
a = [int(input()) for i in range(5)]
print(4 + math.ceil(n / min(a)))
### BUGGY CODE ###

S = input()
Q = int(input())

inv = 0
for i in range(Q):
  query = input().split()
  if query == ['1']:
    inv = (inv + 1)%2
  else:
    f, c = query[1], query[2]
    if f == '1':
      if inv:
        S += c
      else:
        S = c + S
    else:
      if inv:
        S = c + S
      else:
        S += c

if inv:
  print(S[::-1])
else:
  print(S)

### FIXED CODE ###

from collections import deque

S = deque(list(input()))
Q = int(input())

inv = 0
for i in range(Q):
  query = input().split()
  if query == ['1']:
    inv = (inv + 1)%2
  else:
    f, c = query[1], query[2]
    if f == '1':
      if inv:
        S.append(c)
      else:
        S.appendleft(c)
    else:
      if inv:
        S.appendleft(c)
      else:
        S.append(c)

S = list(S)
if inv:
  print(''.join(S[::-1]))
else:
  print(''.join(S))
### BUGGY CODE ###

import itertools

x,y,z,k=(int(i) for i in input().split())
#print(x,y,z,k)
a=list(int(i) for i in input().split())
#a.sort(reverse=True)
b=list(int(i) for i in input().split())
#b.sort(reverse=True)
c=list(int(i) for i in input().split())
#c.sort(reverse=True)
#print(a,b,c)

#a=[int(i) for i in range(1000,-1,-1)]
#b=[int(i) for i in range(1000,-1,-1)]
#c=[int(i) for i in range(1000,-1,-1)]
x=list(itertools.product(a,b))
for i in range(len(x)):
  x[i]=x[i][0]+x[i][1]
x.sort(reverse=True)
y=[]
length=min(len(x),3000)
for i in range(length):
  y+=[x[i]]
#print(len(y))
y=list(itertools.product(y,c))
#print(y)
for i in range(len(y)):
  y[i]=y[i][0]+y[i][1]
y.sort(reverse=True)

for i in range(k):
  print(y[i])


### FIXED CODE ###

#import itertools

x,y,z,k=(int(i) for i in input().split())
#print(x,y,z,k)
a=list(int(i) for i in input().split())
a.sort(reverse=True)
b=list(int(i) for i in input().split())
b.sort(reverse=True)
c=list(int(i) for i in input().split())
c.sort(reverse=True)
#print(a,b,c)

#k=3000
#a=[int(i) for i in range(1000)]
#b=[int(i) for i in range(1000)]
#c=[int(i) for i in range(1000)]
x=[]
for h in range(len(a)):
    for i in range(len(b)):
        if (h+1)*(i+1) <=k:
            for j in range(len(c)):
                if (h+1)*(i+1)*(j+1) <=k:
                    x.append(a[h]+b[i]+c[j])

x.sort(reverse=True)
for i in range(k):
  print(x[i])
### BUGGY CODE ###

n, q = map(int, input().split())
C = [0] + list(map(int, input().split()))
D = [-1]*(n+1)
A = [0]*q
LR = tuple(tuple(map(int, input().split())) for _ in range(q))
W = sorted((r, i) for i, (l, r) in enumerate(LR))
B = [0]*(1<<n.bit_length())
def add(i, a):
  while i <= n:
    B[i] += a
    i += i & -i
def acc(i):
  res = 0
  while i > 0:
    res += B[i]
    i -= i & -i
  return res
temp = 1
for r, i in W:
  while temp <= r:
    c = C[temp]
    add(temp, 1)
    if D[c] != -1:
      add(D[c], -1)
    D[c] = temp
    temp += 1
  l = LR[i][0]
  A[i] = acc(r) - acc(l-1)
print(*A, sep="\n")

### FIXED CODE ###

n, q = map(int, input().split())
C = [0] + list(map(int, input().split()))
D = [-1]*(n+1)
A = [0]*q
U = 10**6
LR = tuple(tuple(map(int, input().split())) for _ in range(q))
W = sorted(r*U+i for i, (l, r) in enumerate(LR))
B = [0]*(1<<n.bit_length())
def add(i, a):
  while i <= n:
    B[i] += a
    i += i & -i
def acc(i):
  res = 0
  while i:
    res += B[i]
    i -= i & -i
  return res
temp = 1
for w in W:
  r, i = divmod(w, U)
  while temp <= r:
    c = C[temp]
    add(temp, 1)
    if D[c] != -1:
      add(D[c], -1)
    D[c] = temp
    temp += 1
  l = LR[i][0]
  A[i] = acc(r) - acc(l-1)
print(*A, sep="\n")
### BUGGY CODE ###

import numpy as np

N,K=map(int,input().split())
p=np.array(list(map(int,input().split())))

print((np.max(np.convolve(p,np.ones(K),'valid'))+K)/2)

### FIXED CODE ###

import numpy as np

N,K=map(int,input().split())
p=np.array(list(map(int,input().split())))

pcm=np.concatenate([np.array([0]),(p+1).cumsum()],0)

print((pcm[K:]-pcm[0:-K]).max() /2)
### BUGGY CODE ###

import sys
from collections import Counter
input=sys.stdin.readline
N=int(input())
d=Counter(list(input()[:-1] for _ in range(N)))
L=[]
for k, v in d.items():
 if v == max(d.values()):
  L.append(k)
L.sort()
for i in L:
 print(i)

### FIXED CODE ###

n=int(input())
arr=[input() for _ in range(n)]
dic={}
for i in range(n): #各単語の出現回数を数える
 if arr[i] not in dic:
   dic[arr[i]]=1
 else:
   dic[arr[i]]+=1
largest=max(dic.values()) #最大の出現回数を求める
ans=[]
for keys in dic.keys():
 if dic[keys]==largest: #出現回数が最も多い単語を集計する
   ans.append(keys)
ans=sorted(ans) #単語を辞書順に並べ替えて出力する
for words in ans:
 print(words)
### BUGGY CODE ###

N,K = map(int,input().split(" "))
p = list(map(int,input().split(" ")))
ans = 0
i = 0
while i <= N-K:
    tmp = p[i:i+K]
    ans = max(ans,(sum(tmp)+K)/2)
    i += 1
print(ans)

### FIXED CODE ###

from itertools import accumulate
N,K = map(int,input().split(" "))
p = list(map(int,input().split(" ")))
pp = list(accumulate(p))
ans = (pp[K-1]+K)/2
for i in range(N-K):
    ans = max(ans,(pp[i+K]-pp[i]+K)/2)
print(ans)
### BUGGY CODE ###

from bisect import bisect_left
def main():
    n = int(input())
    s = list(input().rstrip())
    q = int(input())
    ans = []
    al = [[] for _ in range(26)]
    for i, c in enumerate(s):
        al[ord(c) - ord("a")].append(i)
    for _ in range(q):
        x, y, z = map(str, input().rstrip().split())
        if x == "1":
            y = int(y) - 1
            if s[y] == z:
                continue
            p = ord(z) - ord("a")
            al[p].insert(bisect_left(al[p], y), y)
            al[ord(s[y]) - ord("a")].remove(y)
            s[y] = z
        else:
            y = int(y)
            y -= 1
            z = int(z)
            cnt = 0
            for i in range(26):
                index = bisect_left(al[i], y)
                if index < len(al[i]) and al[i][index] < z:
                    cnt += 1
            ans.append(cnt)
    for v in ans:
        print(v)

if __name__ == "__main__":
    main()

### FIXED CODE ###

from bisect import bisect_left, insort
def main():
    n = int(input())
    s = list(input().rstrip())
    q = int(input())
    ans = []
    al = [[] for _ in range(26)]
    for i, c in enumerate(s):
        al[ord(c) - ord("a")].append(i)
    for _ in range(q):
        x, y, z = map(str, input().rstrip().split())
        if x == "1":
            y = int(y) - 1
            if s[y] == z:
                continue
            p = bisect_left(al[ord(s[y])-ord("a")],y)
            al[ord(s[y])-ord("a")].pop(p)
            insort(al[ord(z)-ord("a")],y)
            s[y] = z
        else:
            y = int(y) - 1
            z = int(z)
            cnt = 0
            for i in range(26):
                index = bisect_left(al[i], y)
                if index < len(al[i]) and al[i][index] < z:
                    cnt += 1
            ans.append(cnt)
    for v in ans:
        print(v)

if __name__ == "__main__":
    main()
### BUGGY CODE ###

s=list(input())
x=0
y=0
while x==0:
  if s[0]!="A":
    del s[0]
  else:
    x=1
while y==0:
  if s[-1]!="Z":
    del s[-1]
  else:
    y=1
print(len(s))
    

### FIXED CODE ###

s=list(input())
x=0
y=0
for i in range(0,len(s)):
  if s[i]=="A":
    x=i
    break
for i in range(1,len(s)):
  if s[-i]=="Z":
    y=i
    break
print(len(s)-x-y+1)
### BUGGY CODE ###

from sys import stdin

n, k = map(int,input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))

def solve():
    max_score = -10**10

    for i in range(n):
        count = 1
        val = c[i]

        next_i = p[i] -1
        while next_i != i:
            count += 1
            val += c[next_i]
            next_i = p[next_i] - 1
        
        if val > 0:
            loop_num = (k//count -1)
            tmp_score = loop_num * val
            max_score = max(tmp_score, max_score)
            num = k%count+count

        else:
            tmp_score = 0
            num = min(k, count)

        next_i = i
        for _ in range(num):
            next_i = p[next_i] - 1
            tmp_score += c[next_i]
            max_score = max(tmp_score, max_score)
    
    print(max_score)

solve()

### FIXED CODE ###

from numba import jit

@jit
def solve():
    n, k = map(int,input().split())
    p = list(map(int, input().split()))
    c = list(map(int, input().split()))
    max_score = -10**10

    for i in range(n):
        count = 1
        val = c[i]

        next_i = p[i] -1
        while next_i != i:
            count += 1
            val += c[next_i]
            next_i = p[next_i] - 1
        
        if val > 0:
            loop_num = (k//count -1)
            tmp_score = loop_num * val
            max_score = max(tmp_score, max_score)
            num = k%count+count

        else:
            tmp_score = 0
            num = min(k, count)

        next_i = i
        for _ in range(num):
            next_i = p[next_i] - 1
            tmp_score += c[next_i]
            max_score = max(tmp_score, max_score)
    
    print(max_score)

solve()
### BUGGY CODE ###

n, k = map(int, input().split())
l = []
for i in range(n):
    l.append(int(input()))

root = [1]*n

for i in range(n)[-2::-1]:
    num = 0
    for j in range(i + 1, n)[:i + 10**4]:
        if abs(l[i] - l[j]) <= k:
            num = max(num, root[j])
    root[i] += num

print(max(root))

### FIXED CODE ###

n, k = map(int, input().split())
l = []
for i in range(n):
    l.append(int(input()))

root = [1]*n

for i in range(n)[-2::-1]:
    num = 0
    for j in range(i + 1, i + 200):
        if j >= n:
            break
        if abs(l[i] - l[j]) <= k:
            num = max(num, root[j])
    root[i] += num

print(max(root))
### BUGGY CODE ###

n,k=map(int,input().split())
li=[[0,0] for i in range(n)]
for i in range(n):
    li[i][0],li[i][1]=map(int,input().split())
 

li.sort(reverse=True,key=lambda x:x[1])

def calc_score(li,choice):
    score=0
    k=[]
    for i in choice:
        score+=li[i][1]
        k.append(li[i][0])        
    score+=len(set(k))**2
    return score

def find_num_neta(choice,li):
    k=[]
    for i in choice:
        k.append(li[i][0])
    return len(set(k))

#-----------------------------------------
best_list=[]
not_best_list=li.copy()

for i in li:
    if i[0] not in [best_list[p][0] for p in range(len(best_list))]:
        best_list.append(i)

for i in best_list:
    not_best_list.remove(i)

#-----------------------------------------


first_choice=list(range(k))
score=calc_score(li,first_choice)
li_choice_set=set([li[i][0] for i in first_choice])


#------------------------------------------------
s2=min(find_num_neta(list(range(n)),li),k)
s1=find_num_neta(first_choice,li)


for i in range(s1+1,s2+1):

    oishisa=0
    for j in range(i):
        oishisa+=best_list[j][1]
    for j in range(k-i):
        oishisa+=not_best_list[j][1]
    
    new_score=i**2+oishisa

    if score<new_score:
        score=new_score
        
    
print(score)

### FIXED CODE ###

n,k=map(int,input().split())
li=[[0,0] for i in range(n)]
for i in range(n):
    li[i][0],li[i][1]=map(int,input().split())



def find_num_neta(choice,li):
    k=[]
    for i in choice:
        k.append(li[i][0])
    return len(set(k))
#-----------------------------------------

li.sort(reverse=True,key=lambda x:x[1])
s2=min(find_num_neta(list(range(n)),li),k)
s1=find_num_neta(list(range(k)),li)
oishisa=sum([li[i][1] for i in range(k)])
score=oishisa+s1**2

#-----------------------------------------
li.sort(key=lambda x:x[0])
best_list=[]
not_best_list=[]


m=-1
for i in li:
    if m==i[0]:
        not_best_list.append(i)
    else:
        best_list.append(i)
        m=i[0]
        
not_best_list.sort(reverse=True,key=lambda x:x[1])
best_list.sort(reverse=True,key=lambda x:x[1])



 
 
for i in range(s1+1,s2+1):
    oishisa=oishisa+best_list[i-1][1]-not_best_list[k-i][1]
    
    new_score=i**2+oishisa
    
    if score<new_score:
        score=new_score
        
    
print(score)
### BUGGY CODE ###

from collections import defaultdict
s = input()
t = input()
ss = set(s)
tt = set(t)
count = 0
for i in tt:
  if not i in ss:
    print(-1)
    break
else:
  dic = defaultdict(list)
  for i in range(len(s)):
    dic[s[i]] += [i]
  ans = 0
  for i in range(len(t)):
    x = ans%len(s)
    for j in dic[t[i]]:
      count += 1
      if j+1>x:
        ans += j+1-x
        break
    else:
      ans += len(s) - x + dic[t[i]][0] + 1
  print(ans)

### FIXED CODE ###

from collections import defaultdict
from bisect import bisect_right
s = input()
t = input()
ss = set(s)
tt = set(t)
count = 0
for i in tt:
  if not i in ss:
    print(-1)
    break
else:
  dic = defaultdict(list)
  for i in range(len(s)):
    dic[s[i]] += [i+1]
  ans = 0
  for i in range(len(t)):
    x = ans%len(s)
    if dic[t[i]][-1]<=x:
      ans = ans - x + len(s) + dic[t[i]][0]
    else:
      ind = bisect_right(dic[t[i]], x)
      ans = ans - x + dic[t[i]][ind]
  print(ans)
### BUGGY CODE ###

def f():
    n = int(input())
    s0 = input()
    poss = []
    for i in range(1000):
        char = str(i)
        poss.append('0'*(3-len(char)) + char)

    def exit(s):
        i = 0
        j = 0
        while i < n:
            if s0[i] == s[j]:
                i += 1
                j += 1
                if j == 3:
                    return True
            else:
                i += 1
        return False

    ans = 0
    for s in poss:
        if exit(s):
            ans += 1
    print(ans)



f()

### FIXED CODE ###

def f():
    n = int(input())
    s = input()
    leftMemo = [None]*10
    rightMemo = [None]*10
    for i in range(10):
        char = str(i)
        for j in range(n):
            if s[j] == char:
                leftMemo[i] = j
                break
        for k in range(n-1,-1,-1):
            if s[k] == char:
                rightMemo[i] = k
                break
    ans = 0
    for leftNum in range(10):
        if leftMemo[leftNum] is None:
            continue
        start = leftMemo[leftNum]+1
        for rightNum in range(10):
            if rightMemo[rightNum] is None:
                continue
            end = rightMemo[rightNum]
            ans += len(set(s[start:end]))
    print(ans)


f()
### BUGGY CODE ###

import sys
input = sys.stdin.readline
import bisect
from collections import deque


def read():
    N = int(input().strip())
    P = list(map(int, input().strip().split()))
    return N, P


def print_map(N, Q):
    for i in range(N):
        print(Q[i*N:(i+1)*N])


def solve(N, P, INF=10**9):
    P = [p-1 for p in P]
    D = [N, -N, 1, -1]
    # Q[p]: 行動の最初にそのマスを踏んだ場合の、脱出までの最短コスト
    Q = [0 for _ in P]
    # LEFT[p]: 取り除いたらTrue
    LEFT = [False for _ in P]
    NN = N * N
    ans = 0

    for i in range(N):
        for j in range(N):
            k = i * N + j
            Q[k] = min(i, j, N-i-1, N-j-1) + 1
    
    for p in P:
        q = deque()
        r = INF
        for dp in D:
            np = p + dp
            if 0 <= np < NN and abs(np%N - p%N) < N-1:
                r = min(r, Q[np])
            else:
                r = 0
        
        ans += r

        LEFT[p] = True
        Q[p] = r
        q.append(p)
        while q:
            pp = q.popleft()
            for dp in D:
                np = pp + dp
                if 0 <= np < NN and abs(np%N - pp%N) < N-1:
                    # 4隣接が除去済みマスなら、コストなしで到達可能
                    if LEFT[np] and Q[np] > Q[pp]:
                        Q[np] = Q[pp]
                        q.append(np)
                    elif not LEFT[np] and Q[np] > Q[pp] + 1:
                        Q[np] = Q[pp] + 1
                        q.append(np)
    return ans


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("{}".format(outputs))


### FIXED CODE ###

import sys
input = sys.stdin.readline
from numba import njit
import numpy


def read():
    N = int(input().strip())
    line = input().strip()
    P = numpy.fromstring(line, dtype=numpy.int32, sep=" ")
    return N, P


@njit
def dfs(N, Q, stay, p, q):
    y, x = divmod(p, N)
    for dy, dx in ((0, 1), (1, 0), (-1, 0), (0, -1)):
        ny, nx = y + dy, x + dx
        if 0 <= ny < N and 0 <= nx < N:
            np = ny * N + nx
            if Q[np] > q:
                Q[np] = q
                dfs(N, Q, stay, np, q + stay[np])


@njit
def np_solve(N, P, INF=10**9):
    P -= 1
    Q = numpy.empty(N*N, dtype=numpy.int32)
    stay = numpy.ones(N*N, dtype=numpy.bool_)
    
    for i in range(N):
        for j in range(N):
            Q[i*N+j] = min([i, j, N-i-1, N-j-1])

    ans = 0
    for p in P:
        stay[p] = 0
        q = Q[p]
        ans += q
        dfs(N, Q, stay, p, q)
    return ans


if __name__ == '__main__':
    outputs = np_solve(*read())
    if outputs is not None:
        print("{}".format(outputs))
### BUGGY CODE ###

#A
"""
a, b, c = map(int, input().split())
print(min(b//a, c))
"""
#B
"""
a, b, k = map(int, input().split())
for i in range(max(a, b), 0, -1):
    if a % i == 0 and b % i == 0:
        k -= 1
        if k == 0:
             print(i)
"""

#C
"""
s = list(input())
an0 = 0
an1 = 0
for i in s:
    if i == "1":
        an1 += 1
    if i == "0":
        an0 += 1
print(min(an0, an1)*2)
"""

#D

n, m = map(int, input().split())
ab = []
for i in range(m):
    ab.append(list(map(int, input().split())))

ab = ab[-1::-1]
size = [1 for _ in range(n)]
height = [1 for _ in range(n)]
par = [i for i in range(n)]
def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
def union(x, y):
    s1 = find(x)
    s2 = find(y)
    if s1 != s2:
        if height[s1] < height[s2]:
            par[s1] = s2
            size[s2] += size[s1]
            size[s1] = 0
        else:
            par[s2] = s1
            size[s1] += size[s2]
            size[s2] = 0
            if height[s1] == height[s2]:
                height[s1] += 1

ans = [0 for i in range(m)]
for num,i in enumerate(ab):
    a = i[0] - 1
    b = i[1] - 1
    union(a, b)
    for k in size:
        ans[num] += (n - k) * k
    ans[num] = ans[num]//2
ans = ans[-1::-1]
ans.append((n * (n - 1)) // 2)
del ans[0]
for i in ans:
    print(i)

### FIXED CODE ###

#A
"""
a, b, c = map(int, input().split())
print(min(b//a, c))
"""
#B
"""
a, b, k = map(int, input().split())
for i in range(max(a, b), 0, -1):
    if a % i == 0 and b % i == 0:
        k -= 1
        if k == 0:
             print(i)
"""

#C
"""
s = list(input())
an0 = 0
an1 = 0
for i in s:
    if i == "1":
        an1 += 1
    if i == "0":
        an0 += 1
print(min(an0, an1)*2)
"""

#D

n, m = map(int, input().split())
ab = []
for i in range(m):
    ab.append(list(map(int, input().split())))

ab = ab[-1::-1]
size = [1 for _ in range(n)]
height = [1 for _ in range(n)]
par = [i for i in range(n)]
def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
def union(x, y):
    s1 = find(x)
    s2 = find(y)
    if s1 != s2:
        if height[s1] < height[s2]:
            par[s1] = s2
            size[s2] += size[s1]
            size[s1] = 0
        else:
            par[s2] = s1
            size[s1] += size[s2]
            size[s2] = 0
            if height[s1] == height[s2]:
                height[s1] += 1
 

ans = [0 for i in range(m)]
ans[0] = n * (n - 1) // 2
for num, i in enumerate(ab):
    if num == m-1:
        break
    a = i[0] - 1
    b = i[1] - 1
    sizea = size[find(a)]
    sizeb = size[find(b)]
    if find(a) == find(b):
        ans[num + 1] = ans[num]
    else:
        ans[num + 1] = ans[num] - (sizea * sizeb)
    union(a,b)
    
    
ans = ans[-1::-1]
for i in ans:
    print(i)
### BUGGY CODE ###

from operator import itemgetter
import collections
N, P = map(int, input().split())

factor = collections.defaultdict(int)

p = 2
n = P
while n > 1:
    while n % p == 0:
        factor[p] += 1
        n //= p
    p += 1

ans = 1
for key, value in factor.items():
    num = value
    while num >= N:
        ans *= key
        num -= N
print(ans)


### FIXED CODE ###

import math
N, P = map(int, input().split())

for i in reversed(range(1, round(math.pow(P, 1 / N)) + 1)):
    if P % (i ** N) == 0:
        print(i)
        exit()
### BUGGY CODE ###

h,w = map(int,input().split())
s = [input() for _ in range(h)]
yoko = []
tate = []
for i in range(h):
    l = []
    k = s[i][0]
    m = 1
    for j in range(1,w):
        if s[i][j]!=k:
            if k=='.':
                l += [m]*m
            else:
                l += [0]*m
            m = 1
            k = s[i][j]
        else:
            m += 1
    if k=='.':
        l += [m]*m
    else:
        l += [0]*m
    yoko.append(l)

for i in range(w):
    l = []
    k = s[0][i]
    m = 1
    for j in range(1,h):
        if s[j][i]!=k:
            if k=='.':
                l += [m]*m
            else:
                l += [0]*m
            m = 1
            k = s[j][i]
        else:
            m += 1
    if k=='.':
        l += [m]*m
    else:
        l += [0]*m
    tate.append(l)
ans = 0
for i in range(h):
    for j in range(w):
        if yoko[i][j] and tate[j][i]:
            ans = max(ans,yoko[i][j]+tate[j][i]-1)
print(ans)

### FIXED CODE ###

h,w = map(int,input().split())
s = [input() for _ in range(h)]
yoko = []
tate = []
for i in range(h):
    l = []
    k = s[i][0]
    m = 1
    for j in range(1,w):
        if s[i][j]!=k:
            if k=='.':
                l += [m]*m
            else:
                l += [0]*m
            m = 1
            k = s[i][j]
        else:
            m += 1
    if k=='.':
        l += [m]*m
    else:
        l += [0]*m
    yoko.append(l)

for i in range(w):
    l = []
    k = s[0][i]
    m = 1
    for j in range(1,h):
        if s[j][i]!=k:
            if k=='.':
                l += [m]*m
            else:
                l += [0]*m
            m = 1
            k = s[j][i]
        else:
            m += 1
    if k=='.':
        l += [m]*m
    else:
        l += [0]*m
    tate.append(l)
ans = 0
for i in range(h):
    for j in range(w):
        if yoko[i][j] and tate[j][i]:
            ans = max(ans,yoko[i][j]+tate[j][i]-1)
print(ans)
### BUGGY CODE ###

import fractions
from functools import reduce

n = int(input())
a = [int(_) for _ in input().split()]
ans = 0

for i in range(n):
    r = reduce(fractions.gcd, a[:i] + a[i+1:])
    if ans < r:
        ans = r

print(ans)


### FIXED CODE ###

import fractions
from functools import reduce

n = int(input())
a = [int(_) for _ in input().split()]
left, right, ans = ([0], [0], 0)

for i in range(n):
    left.append(fractions.gcd(left[i], a[i]))
    right.append(fractions.gcd(right[i], a[n-i-1]))

for i in range(n):
    g = fractions.gcd(left[i], right[n-i-1])
    if ans < g:
        ans = g

print(ans)