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

n=int(input())
a=list(map(int,input().split()))
a=sorted(a)
ans=a[0]#暫定最小

amari=[ans]
if len(set(a))!=1:
    for _ in range(a[0]):
        for i in range(n):
            if a[i]%ans>0:
                amari+=[a[i]%ans]
            ans=min(amari)
        if ans==1:
            break
print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
import fractions as ft


ans=a[0]
for i in a:
    ans=ft.gcd(ans,i)
print(ans)
### BUGGY CODE ###

# ABC068C - Cat Snuke and a Voyage (ARC079C)
import sys
input = sys.stdin.readline

def dijkstra(s: int) -> int:
    D = [float("inf")] * (N + 1)  # distance
    D[s] = 0
    used = [0] * (N + 1)
    while True:
        v = -1
        for i in range(1, N + 1):
            if not used[i] and (v == -1 or D[i] < D[v]):
                v = i
        if v == -1:
            break
        used[v] = 1
        for j in range(1, N + 1):
            D[j] = min(D[j], D[v] + cost[v][j])
    return D[-1]


def main():
    global N, cost
    N, M = tuple(map(int, input().split()))
    E = tuple(tuple(map(int, input().split())) for _ in range(M))
    # cost[v][u] := cost from vertex v to u
    cost = [[float("inf")] * (N + 1) for _ in range(N + 1)]
    for v, u in E:
        cost[v][u] = 1
        cost[u][v] = 1
    flg = dijkstra(1) <= 2
    print("POSSIBLE" if flg else "IMPOSSIBLE")


if __name__ == "__main__":
    main()

### FIXED CODE ###

# ARC079C - Cat Snuke and a Voyage (ABC068C)
import sys
input = sys.stdin.readline

def main():
    n, m = list(map(int, input().rstrip().split()))
    s, d = set(), set()
    for _ in range(m):
        a, b = list(map(int, input().rstrip().split()))
        if a == 1:
            s.add(b)
        elif b == n:
            d.add(a)
    ans = len(s & d)
    print("POSSIBLE" if ans else "IMPOSSIBLE")


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

N,K=map(int,input().split())
A=[list(map(int, input().split())) for i in range(N)]
B,C=zip(*A)
S=10**36
for left in B:
  for right in B:
    for up in C:
      for down in C:
        if left<right and down<up:
          cnt=0
          for x,y in A:
            if left<=x<=right and down<=y<=up:
              cnt+=1
          if cnt>=K:
            S=min(S,(right-left)*(up-down))
print(S)            

### FIXED CODE ###

N,K=map(int,input().split())
A=[list(map(int, input().split())) for i in range(N)]
B,C=zip(*A)
S=10**36
for left in B:
  for right in B:
    for up in C:
      for down in C:
        if left<right and down<up:
          cnt=0
          for x,y in A:
            if left<=x<=right and down<=y<=up:
              cnt+=1
          if cnt>=K:
            S=min(S,(right-left)*(up-down))
print(S)
### BUGGY CODE ###

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

costs = [float('inf')] * N
costs[0] = 0
for i in range(0,N):
  for j in range(1,K+1):
    if i+j >= N:
      break
    costs[i+j] = min(costs[i+j], costs[i] + abs(h[i] - h[i+j]))
print(costs[N-1])

### FIXED CODE ###

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

def aa (n,k,ll):
  dp = [0] * n
  for i in range(1,n):
    s = max(i-k,0)
    mn = float('inf')
    for a,b in zip(dp[s:i],ll[s:i]):
      cur = a + abs(ll[i]-b)
      if cur < mn:
        mn = cur
  
    dp[i] = mn
  print(dp[-1])

aa(N,K,h)
### BUGGY CODE ###

s = input()
t = input()

lens = len(s)
lent = len(t)

dp = [[None] * lent for _ in range(lens)]
# def dfs(aindex=0, bindex=0):
#     if aindex >= lens:
#         return 0
#     if bindex >= lent:
#         return 0
#
#     if dp[aindex][bindex] is not None:
#         return dp[aindex][bindex]
#
#     if s[aindex] == t[bindex]:
#         r = dfs(aindex + 1, bindex + 1) + 1
#     else:
#         r = max(dfs(aindex + 1, bindex), dfs(aindex, bindex + 1))
#     dp[aindex][bindex] = r
#     return r
#
# print(dfs())

dp = [[(0, "")] * (lent + 1) for _ in range(lens + 1)]
dp = [[(0, "") for _ in range(lent + 1)] for _ in range(lens + 1)]
for aindex in range(lens - 1, -1, -1):
    for bindex in range(lent - 1, -1, -1):
        if s[aindex] == t[bindex]:
            length, pattern = dp[aindex + 1][bindex + 1]
            r = (length + 1, s[aindex] + pattern)
        else:
            r = max(dp[aindex + 1][bindex], dp[aindex][bindex + 1])
        dp[aindex][bindex] = r
print(dp[0][0][1])



### FIXED CODE ###

s = input()
t = input()

lens = len(s)
lent = len(t)

# dp = [[None] * lent for _ in range(lens)]
# def dfs(aindex=0, bindex=0):
#     if aindex >= lens:
#         return 0
#     if bindex >= lent:
#         return 0
#
#     if dp[aindex][bindex] is not None:
#         return dp[aindex][bindex]
#
#     if s[aindex] == t[bindex]:
#         r = dfs(aindex + 1, bindex + 1) + 1
#     else:
#         r = max(dfs(aindex + 1, bindex), dfs(aindex, bindex + 1))
#     dp[aindex][bindex] = r
#     return r
#
# print(dfs())

shift = [1 << x for x in range(3000 + 1)]

dp = [[0] * (lent + 1) for _ in range(lens + 1)]
for aindex in range(lens - 1, -1, -1):
    for bindex in range(lent - 1, -1, -1):
        if s[aindex] == t[bindex]:
            r = dp[aindex + 1][bindex + 1] + 1
        else:
            r = max(dp[aindex + 1][bindex], dp[aindex][bindex + 1])
        dp[aindex][bindex] = r

ans = ""
ls = len(s)
lt = len(t)
ls = 0
lt = 0
while ls < lens and lt < lent:
    if dp[ls][lt] == dp[ls + 1][lt]:
        ls += 1
    elif dp[ls][lt] == dp[ls][lt + 1]:
        lt += 1
    else:
        ans += t[lt]
        ls += 1
        lt += 1
print(ans)
### BUGGY CODE ###

# coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)
#from heapq import heappop, heappush
from collections import OrderedDict, defaultdict
#import math
#from itertools import product, accumulate, combinations, product
#import bisect# lower_bound etc
#import numpy as np
#from copy import deepcopy
#from collections import deque
#import numba

def run():
    N = int(input())
    primes = [2]

    for i in range(3, int(N ** (0.5))+1):
        done = False
        for k in primes:
            if not i % k:
                done = True
                break
        if not done:
            primes.append(i)
    #print(primes)

    ret = 1# f(1) = 1

    for i in range(2, N+1):
        current = i
        dic = defaultdict(lambda:(0))
        eval_max = int(i ** (0.5))
        for p in primes:
            if p > eval_max:
                break
            j = 1
            q = p
            x = 0
            while True:
                if not current % q:
                    j *= 2
                    q = p ** j
                else:
                    j = j // 2
                    q = p ** j
                    if j == 0:break
                    if not current % q:
                        current = current // q
                        x += j
                dic[p] = x
        if current != 1:
            dic[current] += 1
        tmp = 1
        for key in dic.keys():
            tmp *= dic[key] + 1
        #print(dic, tmp)
        ret += tmp * i

    print(ret)


if __name__ == "__main__":
    run()

### FIXED CODE ###

# coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)
#from heapq import heappop, heappush
from collections import OrderedDict, defaultdict
#import math
#from itertools import product, accumulate, combinations, product
#import bisect# lower_bound etc
#import numpy as np
#from copy import deepcopy
#from collections import deque
#import numba

def run():
    N = int(input())

    ret = 0
    for i in range(1,N+1):
        tmp = N // i
        left = i
        right = i * tmp
        ret += (left + right) * tmp // 2
    print(ret)
if __name__ == "__main__":
    run()
### BUGGY CODE ###

import queue

N,M,K=map(int,input().split())
friend=[[] for i in range(N)]
block=[[] for i in range(N)]
color=[-1]*N
c=0
for i in range(M):
    a,b=map(int,input().split())
    friend[a-1].append(b-1)
    friend[b-1].append(a-1)
for i in range(K):
    c,d=map(int,input().split())
    block[c-1].append(d-1)
    block[d-1].append(c-1)

q=queue.Queue()

for i in range(N):
    if color[i]==-1:
        q.put(i)
        color[i]=c
        while not q.empty():
            s=q.get()
            for t in friend[s]:
                if color[t]==-1:
                    color[t]=c
                    q.put(t)
        c+=1

count=[0]*c

for i in range(c):
    count[i]=color.count(i)

for i in range(N):
    block_in_color=0
    for t in block[i]:
        if color[i]==color[t]:
            block_in_color+=1
    print(count[color[i]]-len(friend[i])-block_in_color-1)

### FIXED CODE ###

import queue

N,M,K=map(int,input().split())
friend=[[] for i in range(N)]
block=[[] for i in range(N)]
color=[-1]*N
c=0
for i in range(M):
    a,b=map(int,input().split())
    friend[a-1].append(b-1)
    friend[b-1].append(a-1)
for i in range(K):
    a,b=map(int,input().split())
    block[a-1].append(b-1)
    block[b-1].append(a-1)

q=queue.Queue()
count=[0]*N

for i in range(N):
    if color[i]==-1:
        q.put(i)
        color[i]=c
        count[c]+=1
        while not q.empty():
            s=q.get()
            for t in friend[s]:
                if color[t]==-1:
                    color[t]=c
                    count[c]+=1
                    q.put(t)
        c+=1

for i in range(N):
    block_in_color=0
    for t in block[i]:
        if color[i]==color[t]:
            block_in_color+=1
    print(count[color[i]]-len(friend[i])-block_in_color-1)
### BUGGY CODE ###

input()
S = input()
cnt = 0
for i in range(0, 1000):
  c = (i//100, (i//10)%10, i%10)
  f = 0
  for s in S:
    if int(s) == c[f]:
      f += 1 
      if f==3:break 
  if f==3:cnt += 1
print(cnt)


### FIXED CODE ###

input()
S = [int(i) for i in input()]
cnt = 0
for i in range(0, 1000):
  c = (i//100, (i//10)%10, i%10)
  f = 0
  for s in S:
    if s == c[f]:
      f += 1 
      if f==3:break 
  if f==3:cnt += 1
print(cnt)
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
import collections
c = collections.Counter(A)

for i in A:
    temp = c.copy()
    temp[i] = temp[i]-1
    counter = 0
    for j in c.keys():
        n = temp[j]
        if n >= 2:
            counter += n*(n-1)/2
    print(int(counter))

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
import collections
c = collections.Counter(A)
counter = 0
for j in c.keys():
    if c[j]>=2:
        counter+=c[j]*(c[j]-1)/2



for i in A:
    print(int(counter-c[i]+1))
### BUGGY CODE ###

import numpy as np
a,b = map(int,input().split())
moda=np.mod(a,2019)
modb=np.mod(b,2019)
if (modb<=moda)or((b-a)>=2018):
    print(0)
    exit()

num =list(range(moda,modb+1))
ans = 10000
for i,l in enumerate(num):
    if i == len(num)-1:
        break
    for r in num[i+1:]:
        ans = min(np.mod(l*r,2019),ans)
print(ans)

### FIXED CODE ###

import numpy as np
a,b = map(int,input().split())
moda=np.mod(a,2019)
modb=np.mod(b,2019)
if (modb<=moda)or((b-a)>=673):
    print(0)
    exit()

num =list(range(moda,modb+1))

ans = 10000
for i,l in enumerate(num):
    if i == len(num)-1:
        break
    for r in num[i+1:]:
        ans = min(np.mod(l*r,2019),ans)
print(ans)
### BUGGY CODE ###

import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()

print(0)
l = ns()
if l == 'Vacant':
    exit()
print(n-1)
r = ns()
if r == 'Vacant':
    exit()

ng,ok = 0,n-1

def is_ok(p):
    print(p)
    q = ns()
    if q == 'Vacant':
        exit()
    return (not (p-ng)%2 ^ (l == q), q)

while (abs(ok - ng) > 1):
    mid = (ok + ng) // 2
    iss,x = is_ok(mid)
    if iss:
        ok = mid
        r = q
    else:
        ng = mid
        l = q


### FIXED CODE ###

import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = int(input())
print(0)
l = input()
r = l
if l == "Vacant":
    exit()

ng,ok = 0,n
while True:
    mid = (ng + ok) // 2
    print(mid)
    q = input()
    if q == "Vacant":
        exit()
    if (q == l) ^ ((mid - ng)%2 == 1):
        ng = mid
        l = q
    else:
        ok = mid
        r = q
### BUGGY CODE ###

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

def floor(x):
    out = (A * x)//B - A * (x//B)
    return out

max = 0
for i in range(N + 1):
    if(floor(i) > max):
        max = floor(i)


print(max)



### FIXED CODE ###

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

def floor(x):
    out = (A * x)//B - A * (x//B)
    return out

max = 0
#for i in range(N//2, N + 1):
    #if(floor(i) > max):
        #max = floor(i)

if(N < (B-1)):
    max = floor(N)
else:
    max = floor(B-1)

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

MOD = 1000000007;
 
s = input()
 
n=len(s)
 
if n<1 or n>10**5:
	print ('Illegal')
	exit()
b=[0]*13
#pr=[0]*13

p=1

for i in range(n):
	ix=n-1-i
	if(s[ix]=="?"):
		c=-1
	else:
		c=int(s[ix])
	if ( i== 0):
		if (c==-1):
			for j in range(10):
				b[(p*j)%13]=1
		else:
			b[(p*c)%13]=1
	else:
		if (c==-1):
			for j in range(10):
				for k in range(13):
					b[(k+p*j)%13]+=pr[k]
		else:
			for k in range(13):
				b[(k+p*c)%13]+=pr[k]
 
	if (i%30==0 or i==n-1):
		for k in range(13):b[k]%=MOD
	p=p*10%13
	pr=b
	b=[0]*13
#	print (pr)
#	for k in range(13):
#		pr[k]=b[k]
#		b[k]=0
#	print (pr)
print (pr[5])
 

### FIXED CODE ###

MOD = 1000000007;

s = [int(x) if x!="?" else -1 for x in input()]

n=len(s)

r=[0]*13

c=s[0]
if (c!=-1):
	r[c]=1
else:
	for i in range(10):r[i]=1

for i in range(1,n):
	dp=[0]*26
	for j in range(13):dp[j*10%13]+=(r[j]%MOD)
	dp[13:26]=dp[0:13]
	c=s[i]
	r=[0]*13
	if (c==-1):
		w=sum(dp[4:14])
		for j in range(13):
				r[j]+=w
				w=w+dp[j+1]-dp[4+j]
	else:
		for j in range(13):
			r[j]+=dp[13-c+j]
print (r[5]%MOD)
### BUGGY CODE ###

input = raw_input

M = 2019
s = input()
n = len(s)
s = int(s)

div = 10
cumsum = [s % (10 ** i) for i in range(n+1)]
out = 0
for i in range(n+1):
    for j in range(i+1, n+1):
        if (cumsum[j] - cumsum[i]) % M == 0:
            out += 1


print(out)

### FIXED CODE ###

input = raw_input

M = 2019
s = input()
#n = len(s)
#s = int(s)

div = 10

counts = [0] * M
#m = 1

counts[0] += 1
cur = 0

m = 1
for c in reversed(s):
    cur = (int(c) * m + cur) % M
    counts[cur] += 1
    m = (m * 10) % M
    #m *= 10

out = 0
for c in counts:
    out += (c * (c-1) // 2)

print(out)
### BUGGY CODE ###

n,k,*a=map(int,open(0).read().split())
multiple=1
for i in range(k):
    multiple*=a[i]
for j in range(n-k):
    if a[j+k]>a[j]:
        print('Yes')
    else:
        print('No')
    multiple=multiple*a[j+k]/a[j]

### FIXED CODE ###

n,k,*a=map(int,open(0).read().split())
multiple=1
#for i in range(k):
#    multiple*=a[i]
for j in range(n-k):
    if a[j+k]>a[j]:
        print('Yes')
    else:
        print('No')
#    multiple=multiple*a[j+k]/a[j]
### BUGGY CODE ###

s=input()[::-1]
if s[0]=="?":
    p=[1]*10+[0]*3
else:
    p=[0]*13
    p[int(s[0])]=1
q=10
for i in s[1:]:
    if i!="?":
        i=int(i)
        s=q*i%13
        p=p[-s:]+p[:-s]
    else:
        d=[0]*13
        for j in range(10):
            s=q*j%13
            r=p[-s:]+p[:-s]
            d=[r[i]+d[i]for i in range(13)]
        p=[i%(10**9+7) for i in d]
    q=(q*10)%13
print(p[5]%(10**9+7))

### FIXED CODE ###

s=input()[::-1]
p=[1]+[0]*12
q=1
t=[[(i*k)%13 for i in range(10)]for k in range(13)]
for i in s:
    if i!="?":
        i=int(i)
        g=t[q][i]
        p=p[-g:]+p[:-g]
    else:
        d=[0]*13
        for j in t[q]:
            r=p[-j:]+p[:-j]
            d=[(r[i]+d[i])%(10**9+7)for i in range(13)]
        p=d
    q=(q*10)%13
print(p[5]%(10**9+7))
### BUGGY CODE ###

import sys
from operator import itemgetter
import heapq
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
xlist = []
ylist = []
for i in range(N):
  x, y = IL()
  xlist.append([x, i])
  ylist.append([y, i])

xroot = [[] for _ in range(N+1)]
yroot = [[] for _ in range(N+1)]

xlist.sort(key=itemgetter(0)) # [x, ID]
ylist.sort(key=itemgetter(0)) # [y, ID]

for i in range(N-1):
  x, xID = xlist[i]
  nextx, nextxID = xlist[i + 1]
  costx = nextx - x
  xroot[xID].append([costx, nextxID])
  xroot[nextxID].append([costx, xID])

  y, yID = ylist[i]
  nexty, nextyID = ylist[i + 1]
  costy = nexty - y
  yroot[yID].append([costy, nextyID])
  yroot[nextyID].append([costy, yID])
#print(xroot) # [cost, rootID]
#print(yroot)

hpop = heapq.heappop
hpush = heapq.heappush
data = [] # [val, ID]

visited = [False]*(N+1)
hpush(data, [0, 1])
ans = 0
while data:
  val, num = hpop(data)
  if visited[num] == False:
    visited[num] = True
    #print(val, num)
    ans += val
    for i in xroot[num]:
      if visited[i[1]] == False:
        hpush(data, i)
    for j in yroot[num]:
      if visited[j[1]] == False:
        hpush(data, j)
print(ans)


### FIXED CODE ###

import sys
from operator import itemgetter
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def init(n):
  for i in range(N):
    par[i]=i
    rnk[i]=0
def find(x):
  if par[x]==x:
    return x
  else:
    par[x]=find(par[x])
    return par[x]
def unite(x,y):
  x=find(x)
  y=find(y)
  if x==y:
    return
  if (rnk[x]<rnk[y]):
    par[x]=y
  else:
    par[y]=x
    if(rnk[x]==rnk[y]):
      rnk[x]+=1
def same(x,y):
    return find(x)==find(y)

N = I()
xlist = []
ylist = []

par=[0 for i in range(N)]
rnk=[0 for i in range(N)]
init(N)

for i in range(N):
  x, y = IL()
  xlist.append([x, i])
  ylist.append([y, i])
xlist.sort(key=itemgetter(0))
ylist.sort(key=itemgetter(0))

node = []
for i in range(N-1):
  x, xID = xlist[i]
  nextx, nextxID = xlist[i + 1]
  y, yID = ylist[i]
  nexty, nextyID = ylist[i + 1]
  
  node.append([nextx - x, xID, nextxID])
  node.append([nexty - y, yID, nextyID])
node.sort(key=itemgetter(0), reverse=True)

ans = 0
while node:
  val, i, j = node.pop()
  if same(i, j):
    continue
  else:
    unite(i, j)
    ans += val
print(ans)
### BUGGY CODE ###

#E
n=int(input())
C=sorted(list(map(int,input().split())))
mod=10**9+7
sum=0
for i in range(n):
    l=i #その桁より左側の桁数(関係ないやつ)
    r=n-i #その桁より右側の個数(その桁自身も含む、1の個数を数えるやつ)
    if r==1:
        ans=2**l%mod
        ans=ans*C[i]%mod
        sum=(sum+ans)%mod
    else:
        ans=2**(r-1)%mod
        ans=(ans+(2**(r-2)%mod)*(r-1)%mod)%mod
        ans=ans*2**l%mod
        ans=ans*C[i]%mod
        sum=(sum+ans)%mod
print((sum*(2**n%mod)%mod))

### FIXED CODE ###

#E
n=int(input())
C=sorted(list(map(int,input().split())))
mod=10**9+7

pow2=[1]
for i in range(n+5): #2の累乗(mod 10**9+7)のテーブル作成
    pow2.append(pow2[i]*2%mod)

sum=0
for i in range(n):
    l=i #その桁より左側の桁数(関係ないやつ)
    r=n-i #その桁より右側の個数(その桁自身も含む、1の個数を数えるやつ)
    if r==1:
        ans=pow2[l]
        ans=ans*C[i]%mod
        sum=(sum+ans)%mod
    else:
        ans=pow2[r-1]
        ans=(ans+pow2[r-2]*(r-1)%mod)%mod
        ans=ans*pow2[l]%mod
        ans=ans*C[i]%mod
        sum=(sum+ans)%mod
print((sum*pow2[n]%mod))
### BUGGY CODE ###

from sys import stdin
import sys
sys.setrecursionlimit(10**6)
def S(): return stdin.readline().rstrip()

a = S()
def f(t,a):
    if t == a:
        return True
    elif len(a)<len(t):
        return False
    else:
        strl = ['dream','dreamer','erase','eraser']
        for i in strl:
            if t+i in a[:len(t+i)]:
                if f(t+i,a):
                    return True
        return False

if f('',a):
    print('YES')
else:
    print('NO')

### FIXED CODE ###

from sys import stdin
def S(): return stdin.readline().rstrip()

a = S()
strl = ['dream','dreamer','erase','eraser']
t = ''
for i in range(len(a)-1,-1,-1):
    if 7<len(t):
        print('NO')
        exit()
    else:
        t = a[i]+t
        if t in strl:
            t = ''

print('YES')
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
a=sorted(a)
p=[0]*(10**6+1)
for i in a:
    if p[i]==0:
        j=2
        while i*j<=10**6:
            p[i*j]=1
            j+=1
a.append(-1)
a.insert(0,-1)
ans=0
for i in range(1,n+1):
    if a[i]!=a[i+1] and a[i]!=a[i-1] and p[a[i]]==0:
        ans+=1
print(ans)


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
a=sorted(a)
b=list(set(a))
m=len(b)

p=[0]*(10**6+1)
for i in b:
    if p[i]==0:
        j=2
        while i*j<=10**6:
            p[i*j]=1
            j+=1
a.append(-1)
a.insert(0,-1)
ans=0
for i in range(1,n+1):
    if a[i]!=a[i+1] and a[i]!=a[i-1] and p[a[i]]==0:
        ans+=1
print(ans)
### BUGGY CODE ###

while True:
    a,b  = 5,10
    if a ==0 and b == 0:
        break
    for i in range(a):
        if i ==0 or i == (a-1):
            print("#", end = "")
            print("."*(b-2), end = "")
            print("#")
        else:
            print("#"*b)
    print()



### FIXED CODE ###

2
3
4
5
6
7
8
9
while 1:
    (H,W) = [int(i) for i in input().split()]
    if H==W==0:
        break
    print('#'*W)
    for i in range(H-2):
        print('#'+'.'*(W-2)+'#')
    print('#'*W)
    print('')
### BUGGY CODE ###

n=int(input())

s=[]
for i in range(n):
    s.append(input())
k=s.copy()   
candidates=list(set(k))

maxnum=0
for candidate in candidates:
    maxnum=max(maxnum,s.count(candidate))
    
ans=[]
for candidate in candidates:
    if s.count(candidate)==maxnum:
        ans.append(candidate)
ans.sort()


for i in ans:
    print(i)

### FIXED CODE ###

n=int(input())

candidates={}
for i in range(n):
    candidate=input()
    if candidate in candidates:
        candidates[candidate]+=1
    else:
        candidates[candidate]=1

max_k_list = []
maxvalue=max(candidates.values())
for candidate in candidates:
    if candidates[candidate]==maxvalue:
        max_k_list.append(candidate)


max_k_list.sort()
for i in max_k_list:
    print(i)
### BUGGY CODE ###

import math

K = int(input())
ans = 0

def func(a, b, c):
    x = math.gcd(a, b)
    return math.gcd(x, c)

for i in range(K):
    for j in range(K):
        for k in range(K):
            ans += func(i+1, j+1, k+1)

print(ans)


### FIXED CODE ###

from math import gcd

K = int(input())

ans = 0

for a in range(1, K+1):
    for b in range(1, K+1):
        g = gcd(a, b)
        for c in range(1, K+1):
            ans += gcd(g, c)

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

N = int(input())
A = map(int, input().split())
B = map(int, input().split())
C = map(int, input().split())

A = list(A)
B = list(B)
C = list(C)

count = 0
for a in A:
    for b in B:
        if a < b:
            for c in C:
                if b < c:
                    count += 1

print(count)


### FIXED CODE ###

import bisect

N = int(input())
A = map(int, input().split())
B = map(int, input().split())
C = map(int, input().split())

A = list(A)
A.sort()
B = list(B)
B.sort()
C = list(C)
C.sort()

count = 0

for b in B:
    l = bisect.bisect_left(A, b)
    r = bisect.bisect_right(C, b)
    count += l * (N - r)

print(count)
### BUGGY CODE ###

import itertools

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

total = 0
for i in range(K, N+2):
    sum_list = []
    for l in list(itertools.combinations(range(N+1), i)):
        sum_list.append(sum(l))
    total += len(set(sum_list))
    # print(total)
    # print("~~~")

print(total)


### FIXED CODE ###

import itertools

N, K = map(int, input().split())
mod = (10 ** 9 + 7)

def calc(i):
    small = i * (i - 1) //2
    large = i * (2 * N - i + 1) // 2
    return large - small + 1

total = 0
for i in range(K, N+2):
    total += calc(i)
    total %= mod

print(total)