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

import sys
sys.setrecursionlimit(10**7)

N,M,K=map(int,input().split())


par=[index for index in range(N+1)]

def root(x):
    global par

    if x==par[x]:
        return x
    else:
        par[x]=root(par[x])
        return par[x]


def same(x,y):
    global par

    if root(x)==root(y):
        return True
    else:
        return False

def unite(x,y):
    global par

    if root(x)!=root(y):
        par[root(x)]=root(y)


friends=[[] for index1 in range(N+1)]
for index2 in range(M):
    a,b=map(int,input().split())
    unite(a,b)
    friends[a].append(b)
    friends[b].append(a)


block=[[] for index3 in range(N+1)]
for index4 in range(K):
    c,d=map(int,input().split())
    block[c].append(d)
    block[d].append(c)


relates=[0]*(N+1)
for i in range(1,N+1):
    relates[root(i)]+=1


Ans=[]
for j in range(1,N+1):
    ans=relates[root(j)]-1    #高速化可能   #1
    for k in friends[j]:
        if same(j,k):
            ans-=1
    for l in block[j]:
        if same(j,l):   #まとめられる
            ans-=1

    Ans.append(ans)

print(*Ans)



### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

N,M,K=map(int,input().split())


par=[index for index in range(N+1)]

def root(x):
    global par

    if x==par[x]:
        return x
    else:
        par[x]=root(par[x])
        return par[x]


def same(x,y):
    global par

    if root(x)==root(y):
        return True
    else:
        return False

def unite(x,y):
    global par

    if root(x)!=root(y):
        par[root(x)]=root(y)


friends=[[] for index1 in range(N+1)]
for index2 in range(M):
    a,b=map(int,input().split())
    unite(a,b)
    friends[a].append(b)
    friends[b].append(a)


block=[[] for index3 in range(N+1)]
for index4 in range(K):
    c,d=map(int,input().split())
    block[c].append(d)
    block[d].append(c)


relates=[0]*(N+1)
for i in range(1,N+1):
    relates[root(i)]+=1


Ans=[]
for j in range(1,N+1):
    ans=relates[root(j)]-1    #高速化可能   #1
    for k in friends[j]:
        if same(j,k):
            ans-=1
    for l in block[j]:
        if same(j,l):   #まとめられる
            ans-=1

    Ans.append(ans)

print(*Ans)
### BUGGY CODE ###

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

ans = [-1] * N

for i in range(N):
    ans[A[i] - 1] = A.index(A[i])+1

print(*ans)


### FIXED CODE ###

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

out = [0] * N

for i in range(N):
    out[A[i] - 1] = i + 1
print(*out)
### BUGGY CODE ###

N, P = map(int, input().split())
S = input()

if P == 2:
    cnt = 0

    cnt_2 = 0
    for s in S[::-1]:
        if int(s) % 2 == 0:
            cnt_2 += 1

        cnt += cnt_2
elif P == 5:
    cnt = 0

    cnt_0 = 0
    cnt_5 = 0
    for s in S[::-1]:
        if s == '0':
            cnt_0 += 1
        elif s == '5':
            cnt_5 += 1

        cnt += cnt_0
        cnt += cnt_5
else:
    dic = {}
    dic[0] = 1
    cnt = 0
    num = ''
    for s in S[::-1]:
        num = s + num
        r = int(num) % P

        cnt += dic.get(r, 0)

        if r not in dic:
            dic[r] = 1
        else:
            dic[r] += 1

print(cnt)


### FIXED CODE ###

N, P = map(int, input().split())
S = input()

if P == 2 or P == 5:
    cnt = 0

    cnt_a = 0
    for s in S[::-1]:
        if int(s) % P == 0:
            cnt_a += 1

        cnt += cnt_a
else:
    r_lst = [0] * P
    r_lst[0] = 1

    cnt = 0
    num = 0

    for i, s in enumerate(S[::-1]):
        num  = (num + int(s) * pow(10, i, P)) % P
        cnt += r_lst[num]

        r_lst[num] += 1


print(cnt)
### BUGGY CODE ###

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

def gcd(a, b):
  while b:
    a, b = b, a%b
  return a

resmax = 0
for j in range(n):
	if j == 0:
		res = ai[1]
		for i in range(2,n):
			res = gcd(ai[i],res)
	else:
		res = ai[0]
		for i in range(1,n):
			if i == j:
				continue
			else:
				res = gcd(ai[i],res)
	if res > resmax:
		resmax = res

#print(resi)
print(resmax)


### FIXED CODE ###

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

def gcd(a, b):
  while b:
    a, b = b, a%b
  return a

r=[]
l=[]
resr = ai[0]
resl = ai[n-1]
r.append(ai[0])
l.append(ai[n-1])
for i in range(1,n):
	resr=gcd(resr,ai[i])
	r.append(resr)
	resl=gcd(resl,ai[n-1-i])
	l.append(resl)

#print(r)
#print(l)

resmax = 1
for i in range(n):
	if i == 0:
		res = l[n-1-1]
	elif i == n-1:
		res = r[n-1-1]
	else:
		res = gcd(r[i-1], l[n-1-i-1])
	if res > resmax:
		resmax = res

print(int(resmax))
### BUGGY CODE ###

n=int(input())
a=sorted(list(map(int,input().split())))
c=[1]*n
for i in range(n-1):
  t=a[i]
  if c[i]:
    if t==a[i+1]:
      c[i]=0
    for j in range(i+1,n):
      if a[j]%t==0:
        c[j]=0
print(sum(c))

### FIXED CODE ###

n=int(input())
a=sorted(list(map(int,input().split())))
m=max(a)
b=[1]*m
c=[0]*m
for i in a:
  c[i-1]+=1
  if b[i-1]:
    for j in range(i*2-1,m,i):
      b[j]=0
x=0
for i in range(m):
  if b[i] and c[i]==1:
    x+=1
print(x)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

def input_converter(key_string):
    key_string = key_string.replace('A', '1')
    key_string = key_string.replace('T', '2')
    key_string = key_string.replace('C', '3')
    key_string = key_string.replace('G', '4')
    return int(key_string)


class HashTable(object):
    def __init__(self, hash_size = 2 ** 23):
        self.hash_size = hash_size
        self.hash_array = [None] * self.hash_size

    def insert_value(self, data, key):
        collision_number = 0
        next_index = self.hash_function(key, collision_number)
        while self.hash_array[next_index] is not None:
            collision_number += 1
            next_index = self.hash_function(key, collision_number)
        # print self.hash_array[next_index]
        self.hash_array[next_index] = data

    def search_value(self, data, key):
        collision_number = 0
        next_index = self.hash_function(key, collision_number)
        while True:
            if (self.hash_array[next_index] is None) or (collision_number > self.hash_size):
                return False
            elif self.hash_array[next_index] == data:
                return True
            else:            
                collision_number +=1
                next_index = self.hash_function(key, collision_number)

    def hash_function(self, key, collision_number):
        def h1(key):
            return key % self.hash_size
    
        def h2(key):
            return key % (self.hash_size - 1)

        return (h1(key) + collision_number * h2(key)) % self.hash_size


def main():
    input_size = int(raw_input())
    hash_table = HashTable(2 ** 20)
    counter = 0
    while counter < input_size:
        command, key = raw_input().split(' ')
        if command == 'insert':
            hash_table.insert_value(key, input_converter(key))
        else:
            if hash_table.search_value(key, input_converter(key)):
                print 'yes'
            else:
                print 'no'
        counter += 1


if __name__ == '__main__':
    main()

### FIXED CODE ###

# -*- coding: utf-8 -*-

dictionary = {}
input_num = int(raw_input())
counter = 0
while counter < input_num:
    command, key = raw_input().split(' ')
    if command == 'insert':
        dictionary[key] = None
    else:
        if key in dictionary:
            print 'yes'
        else:
            print 'no'

    counter += 1
### BUGGY CODE ###

import heapq

q = int(input())
inf = 10000000000
left = [inf]
right = [inf]
minval = 0
for _ in range(q):
    query = list(map(int, input().split()))
    if query[0] == 1:
        _, a, b = query
        if a < -left[0]:
            v = -heapq.heappop(left)
            heapq.heappush(right, v)
            heapq.heappush(left, -a)
            heapq.heappush(left, -a)
            minval += abs(v - a) + b
        elif a > right[0]:
            v = heapq.heappop(right)
            heapq.heappush(left, -v)
            heapq.heappush(right, a)
            heapq.heappush(right, a)
            minval += abs(v - a) + b
        else:
            heapq.heappush(left, -a)
            heapq.heappush(right, a)
            minval += b
    else:
        print(-left[0], minval)

### FIXED CODE ###

import heapq

q = int(input())
inf = 10000000000
left = [inf]
right = [inf]
minval = 0
for _ in range(q):
    query = list(map(int, input().split()))
    if query[0] == 1:
        _, a, b = query
        if a < -left[0]:
            v = -heapq.heappop(left)
            heapq.heappush(right, v)
            heapq.heappush(left, -a)
            heapq.heappush(left, -a)
            minval += abs(v - a) + b
        elif a > right[0]:
            v = heapq.heappop(right)
            heapq.heappush(left, -v)
            heapq.heappush(right, a)
            heapq.heappush(right, a)
            minval += abs(v - a) + b
        else:
            heapq.heappush(left, -a)
            heapq.heappush(right, a)
            minval += b
    else:
        print(-left[0], minval)
### BUGGY CODE ###

N,K = map(int,input().split())
H = list(map(int,input().split()))

ans = [10**10 for i in range(N+1)]
ans[0],ans[1] = 0,0
for i in range(1,N+1):
    for k in range(1,K+1):
        if i-k > 0:
            ans[i] = min(ans[i-k]+abs(H[i-1]-H[i-k-1]),ans[i])
print(ans[-1])
    

### FIXED CODE ###

N,K = map(int,input().split())
H = list(map(int,input().split()))
 
ans = [10**10 for i in range(N+1)]
ans[0],ans[1] = 0,0
for i in range(1,N+1):
    for k in range(1,K+1):
        if i-k > 0:
            ans[i] = min(ans[i-k]+abs(H[i-1]-H[i-k-1]),ans[i])
print(ans[-1])
### BUGGY CODE ###

mod = 10**9+7 #出力の制限
N = 2*10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

def func(n):
    if n%2==0:
        return (-g1[n]*g2[n//2]*pow(inverse[2],n//2,mod))%mod
    else:
        return 0

import sys

sys.setrecursionlimit(10**5)

N=int(input())
edge=[[] for i in range(N)]
for i in range(N-1):
    x,y=map(int,input().split())
    edge[x-1].append(y-1)
    edge[y-1].append(x-1)


dp=[[] for i in range(N)]
sz=[0 for i in range(N)]

def dfs(v,pv):
    sz[v]=1
    dp[v]=[0]*(sz[v]+1)
    dp[v][1]=1
    for nv in edge[v]:
        if nv!=pv:
            dfs(nv,v)
            merged=[0]*(sz[v]+sz[nv]+1)
            for i in range(sz[v]+1):
                for j in range(sz[nv]+1):
                    merged[i+j] +=dp[v][i]*dp[nv][j]
                    merged[i+j]%=mod
            sz[v]+=sz[nv]
            dp[v] =merged
    dp[v][0]=(sum(func(k)*dp[v][k] for k in range(1,sz[v]+1)))%mod
    if v==0:
        dp[v][0]=(dp[v][0]-func(N)*dp[v][N])%mod

dfs(0,-1)

print((-func(N)-dp[0][0])%mod)

### FIXED CODE ###

mod = 10**9+7 #出力の制限
N = 2*10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

import sys

sys.setrecursionlimit(10**4)

N=int(input())
edge=[[] for i in range(N)]
parent=[0]*N
deg=[1]*N
deg[0]=0
for i in range(N-1):
    x,y=map(int,input().split())
    edge[x-1].append(y-1)
    edge[y-1].append(x-1)


def prv(v,pv):
    for nv in edge[v]:
        if nv!=pv:
            parent[nv]=v
            prv(nv,v)

prv(0,-1)

for i in range(N):
    new=[]
    for v in edge[i]:
        if v!=parent[i]:
            new.append(v)
    edge[i]=new


from collections import deque
ans = list(v for v in range(N) if deg[v]==0)
deq = deque(ans)
used = [0]*N

while deq:
    v = deq.popleft()
    for t in edge[v]:
        deg[t] -= 1
        if deg[t]==0:
            deq.append(t)
            ans.append(t)


dp=[[] for i in range(N)]
sz=[0 for i in range(N)]

for v in ans[::-1]:
    sz[v]=1
    dp[v]=[0]*(sz[v]+1)
    dp[v][1]=1
    for nv in edge[v]:
        merged=[0]*(sz[v]+sz[nv]+1)
        for i in range(sz[v]+1):
            for j in range(sz[nv]+1):
                merged[i+j]=(merged[i+j]+dp[v][i]*dp[nv][j])%mod
        sz[v]+=sz[nv]
        dp[v] =merged
    for k in range(1,sz[v]+1):
        dp[v][0]=(dp[v][0]-(g1[k]*g2[k//2])%mod*((k+1)%2)*dp[v][k])%mod

print((-dp[0][0]*pow(inverse[2],N//2,mod))%mod)
### BUGGY CODE ###

from math import sqrt
N = int(input())

for n in range(1, N+1):
    count = 0
    for x in range(1, int(sqrt(n))):
        for y in range(1,int(sqrt(n))):
            for z in range(1, int(sqrt(n))):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == n:
                    count += 1
    print(count)

### FIXED CODE ###

from math import sqrt
N = int(input())
ans = [0] * (N+1)

for x in range(1, int(sqrt(N)) + 2):
    for y in range(1,int(sqrt(N)) + 2):
        for z in range(1, int(sqrt(N)) + 2):
            n = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if n <= N:
                ans[n] += 1

for i in range(1, len(ans)):
    print(ans[i])
### BUGGY CODE ###

#import collections
import numpy

def get_index(l, n):
    tmp = [x for x in l if x <= n]
    return len(tmp)

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

Ac = numpy.cumsum(A)
Bc = numpy.cumsum(B)

ans = 0
for i in range(len(Ac)):
    n = K - Ac[i]
    if n < 0: break
    ans = i + 1
    ans += get_index(Bc, n)
ans = max(ans, get_index(Ac, K), get_index(Bc, K))
print(ans)


'''
#Aq = collections.deque(A)
#Bq = collections.deque(B)

ans = 0
sumt = 0
flag = True
while len(Aq) > 0 and len(Bq) > 0:
    if Aq[0] <= Bq[0]:
        if sumt + Aq[0] > K:
            flag = False
            break
        sumt += Aq.popleft()
        ans += 1
    else:
        if sumt + Bq[0] > K:
            flag = False
            break
        sumt += Bq.popleft()
        ans += 1
if flag:
    if len(Aq) > 0:
        while len(Aq) > 0:
            if sumt + Aq[0] > K:
                break
            sumt += Aq.popleft()
            ans += 1
    else:
        while len(Bq) > 0:
            if sumt + Bq[0] > K:
                break
            sumt += Bq.popleft()
            ans += 1
print(ans)
'''

### FIXED CODE ###

import bisect

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

Ac = [0]*(N+1)
Bc = [0]*(M+1)
for i in range(1, N+1):
    Ac[i] = Ac[i-1] + A[i-1]
for j in range(1, M+1):
    Bc[j] = Bc[j-1] + B[j-1]

ans = 0
for i in range(N+1):
    n = K - Ac[i]
    if n < 0: break
    tmp = bisect.bisect_right(Bc, n) - 1
    ans = max(ans, i + tmp)
    #print(i, tmp, ans, n, Ac, Bc)
print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
ans = 1
for i in range(n):
    ans *= a[i]
if ans > 1000000000000000000: print(-1)
else:print(ans)

### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
ans = 1
max = 10**18
if 0 in A:
    print(0)
    exit(0)
for i in range(n):
    ans *= A[i]
    if (ans > max):
        print(-1)
        exit(0)
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python3

n = int(input())
a = [int(x) for x in input().split()]
c = 0
b = [{i + 1, x} for i, x in enumerate(a)]
for i, e in enumerate(sorted(b)):
    if b.count(e) == 2:
        c += 1
print(c // 2)


### FIXED CODE ###

#!/usr/bin/env python3

n = int(input())
a = [int(x) for x in input().split()]
c = 0
for i, ax in enumerate(a):
    if a[ax - 1] == i + 1:
        c += 1
print(c // 2)
### BUGGY CODE ###

from sys import setrecursionlimit

setrecursionlimit(3 * 10 ** 5)

class Node:
  def __init__(self, id):
    self.id = id
    self.children = []
    self.block_id_set = set()
    self.size = 1

  def add_child(self, node):
    self.children.append(node)

  def add_block(self, id):
    self.block_id_set.add(id)


def main():
  n, m, k = map(int, input().split(' '))
  nodes = tuple([Node(i) for i in range(n)])
  for _ in range(m):
    a, b = sorted(map(lambda x: int(x) - 1, input().split()))
    nodes[a].add_child(nodes[b])
    nodes[b].add_child(nodes[a])

  for _ in range(k):
    c, d = sorted(map(lambda x: int(x) - 1, input().split()))
    nodes[c].add_block(d)
    nodes[d].add_block(c)

  total_done_set = set()

  def dfs(node, done_set):
    if node.id in done_set: return 0

    total_done_set.add(node.id)
    done_set.add(node.id)

    for child in node.children:
      node.size += dfs(child, done_set)

    return node.size


  ans_list = [0] * n

  def dfs2(node, done_set, connected_ids):
    if node.id in done_set: return 0

    done_set.add(node.id)

    ans_list[node.id] = len(connected_ids) - len(list(filter(
      lambda block_id: block_id in connected_ids,
      node.block_id_set
    ))) - 1

    for child in node.children:
      if child.id not in node.block_id_set:
        ans_list[node.id] -= 1

      dfs2(child, done_set, connected_ids)


  for base_node in nodes:
    if base_node.id not in total_done_set:
      done_set = set()
      dfs(base_node, done_set)
      dfs2(base_node, set(), done_set)

  print(*ans_list, sep=" ")


main()


### FIXED CODE ###

from sys import setrecursionlimit

setrecursionlimit(3 * 10 ** 5)

def main():
  n, m, k = map(int, input().split(' '))
  nodes = tuple([([], set()) for i in range(n)])
  for _ in range(m):
    a, b = sorted(map(lambda x: int(x) - 1, input().split()))
    nodes[a][0].append(b)
    nodes[b][0].append(a)

  for _ in range(k):
    c, d = sorted(map(lambda x: int(x) - 1, input().split()))
    nodes[c][1].add(d)
    nodes[d][1].add(c)

  total_done_set = set()

  def dfs(node_id, done_set):
    if node_id in done_set: return 0

    total_done_set.add(node_id)
    done_set.add(node_id)

    size = 1
    for child_id in nodes[node_id][0]:
      size += dfs(child_id, done_set)

    return size


  ans_list = [-1] * n

  def dfs2(node_id, connected_ids, total_len):
    children, block_id_set = nodes[node_id]
    ans_list[node_id] = total_len - len(list(filter(
      lambda block_id: block_id in connected_ids, block_id_set
    ))) - 1

    except_num = 0
    for child_id in children:
      if child_id not in block_id_set:
        except_num += 1

      if ans_list[child_id] == -1:
        dfs2(child_id, connected_ids, total_len)

    ans_list[node_id] -= except_num


  for i in range(n):
    if i not in total_done_set:
      done_set = set()
      dfs(i, done_set)
      dfs2(i, done_set, len(done_set))

  print(*ans_list, sep=" ")


main()
### BUGGY CODE ###

n, m = map(int, input().split())
a1 = []
bn = []

for i in range(m):
  a, b = map(int, input().split())
  if a == 1:
    a1.append(b)
  elif b == n:
    bn.append(a)


for x in a1:

    if x in bn:
      print('POSSIBLE')
      exit()
print('IMPOSSIBLE')

### FIXED CODE ###

n, m = map(int, input().split())
a1 = []
bn = []

for i in range(m):
  a, b = map(int, input().split())
  if a == 1:
    a1.append(b)
  elif b == n:
    bn.append(a)
la = len(a1)
lb = len(bn)
sa = set(a1)
sb = set(bn)
if len(sa | sb) < la + lb:
  print('POSSIBLE')
  exit()
print('IMPOSSIBLE')
### BUGGY CODE ###

n = int(input())
x = list(map(int,input().split()))
tmp = 0
i = 0
while tmp < (sum(x) / 2):
    tmp += x[i]
    i += 1
# 2 4 3 sum=9 tmp=6 i=2  
a = tmp - (sum(x) - tmp)
b = (sum(x) - tmp + x[i-1]) - (tmp - x[i-1])
print(min(a, b))

### FIXED CODE ###

n = int(input())
s = list(map(int,input().split()))
ans = 2020202020
a = 0
b = sum(s)
for i in range(n):
    a += s[i]
    b -= s[i]
    ans = min(ans,abs(a-b))
print(ans)
### BUGGY CODE ###

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd
from operator import mul
from functools import reduce
from operator import mul
import pprint



sys.setrecursionlimit(2147483647)
INF = 100
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

n = I()
A = sorted(LI())
s = set()
for a in A:
    i = 2
    if a in s:
        continue
    while a * i <= 10 ** 6:
        s.add(a * i)
        i += 1

cnt = Counter(A)
ans = 0
for a in A:
    if a not in s and cnt[a] == 1:
        ans += 1

print(ans)





### FIXED CODE ###

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd
from operator import mul
from functools import reduce
from operator import mul
import pprint



sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

n = I()
A = sorted(LI())
ans = 0
cnt = Counter(A)
m = max(A) + 1
B = [0] * (10 ** 6 + 1)
for a in A:
    if B[a] == 0 and cnt[a] == 1:
        ans += 1
    for i in range(a * 2, m, a):
        B[i] = 1


print(ans)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
for i in range(n):
  print(a.count(i+1))

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
c=[0 for _ in range(n)]
for i in range(len(a)):
  c[a[i]-1]+=1
for j in range(len(c)):
  print(c[j])
### BUGGY CODE ###

def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
[n,k]=i2()
x=[]
y=[]
z=[]
for i in range(n):
 z.append(i2())
 x.append(z[-1][0])
 y.append(z[-1][1])
x.sort()
y.sort()
a=float("inf")
for i in range(n):
 for j in range(i,n):
  for kk in range(n):
    for l in range(kk,n):
      if len(list(filter(lambda xx:x[i]<=xx[0]<=x[j] and y[kk]<=xx[1]<=y[l] , z)))==k:
       a=min(a,(x[j]-x[i])*(y[l]-y[kk]))  
print(a)

### FIXED CODE ###

def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
[n,k]=i2()
x=[]
y=[]
zz=[]
for i in range(n):
 z=i2()
 x.append([z[0],i])
 y.append([z[1],i])
 zz.append(z)
x.sort()
y.sort()
xx=[i[1] for i in x]
yy=[i[1] for i in y]
a=float("inf")
for i in range(n):
 for j in range(i,n):
  for kk in range(n):
   for l in range(kk,n):
     if len(set(xx[i:j+1])&set(yy[kk:l+1]))==k:
         a=min(a,(zz[xx[j]][0]-zz[xx[i]][0])*(zz[yy[l]][1]-zz[yy[kk]][1]))
print(a)
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split(" ")))

import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


ans=0
GCD_target=gcd_list(A)
#print("GCD_target = {}".format(GCD_target))

for i in range(N):
   copied_A = A[:]
   copied_A.pop(i)
   GCD_current=gcd_list(copied_A)
   #print(GCD_current)
   ans=max(ans,GCD_current)

print(ans)

### FIXED CODE ###

from fractions import *
n = int(input())
a = [0]+list(map(int, input().split()))+[0]
b = [0]*(n+2)
c = [0]*(n+2)
for i in range(1, n+1):
	b[i] = gcd(b[i-1], a[i])
for i in range(n, 0, -1):
	c[i] = gcd(c[i+1], a[i])

ans=1
for i in range(1, n+1):
    x1 = b[i-1]
    x2 = c[i+1]
    ans=max(ans, gcd(x1, x2))

print(ans)