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

import sys
sys.setrecursionlimit(1000000)
readline = sys.stdin.readline
from collections import deque


def solve_beam():
    D = int(readline())
    C = list(map(int, readline().split()))
    S = [list(map(int, readline().split())) for i in range(D)]
    N = 26

    lasts = [0] * N

    ans = [None] * D

    W, DEPTH = 3, 7

    def rec(day, rem):
        if rem == 0 or day > D:
            return 0, 0
        gains = [(S[day - 1][t] + (day - lasts[t]) * C[t], t) for t in range(N)]
        gains.sort(reverse=True)
        max_gain = -1e10
        max_gain_t = 0
        for i in range(W):
            gain, t = gains[i]
            _t = lasts[t]
            lasts[t] = day
            f_gain, _ = rec(day + 1, rem - 1)
            lasts[t] = _t
            gain += f_gain
            if gain > max_gain:
                max_gain = gain
                max_gain_t = t

        return max_gain, max_gain_t

    _total = 0
    for day in range(D):
        _, t = rec(day, DEPTH)
        lasts[t] = day
        ans[day - 1] = t
        _total += _
    
    for a in ans:
        print(a + 1)


solve_beam()

### FIXED CODE ###

import sys
readline = sys.stdin.readline

def solve_greedy():
    D = int(readline())
    C = list(map(int, readline().split()))
    S = [list(map(int, readline().split())) for i in range(D)]
    N = 26

    lasts = [0] * N

    ans = [None] * D

    for day in range(1, D + 1):
        m, mt = -1e10, 0
        for t in range(N):
            a = S[day - 1][t] + (day - lasts[t]) * C[t]
            if a > m:
                mt = t
                m = a
        
        lasts[mt] = day

        neg = sum((day - lasts[t]) * C[t] for t in range(N))
        pos = S[day - 1][t]

        ans[day - 1] = mt
    
    for a in ans:
        print(a + 1)



solve_greedy()
### BUGGY CODE ###

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

ans = 0
for i in range(N):
    for j in range(N):
        if B[i] <= A[j]:
            continue
        for k in range(N):
            if B[i] < C[k]:
                ans += 1
print(ans)

### FIXED CODE ###

from bisect import bisect_left, bisect_right
N = int(input())
*A, = map(int, input().split())
*B, = map(int, input().split())
*C, = map(int, input().split())
A.sort()
B.sort()
C.sort()
ans = 0
for b in B:
    a = bisect_left(A, b)
    c = bisect_right(C, b)
    ans += a * (N-c)
print(ans)
### BUGGY CODE ###

import numpy as np
import copy
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

for i in range(N):
    tmp = copy.deepcopy(A)
    tmp[i] = 0
    print(np.max(tmp))

### FIXED CODE ###

import numpy as np
import copy
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

tmp = copy.deepcopy(A)
tmp = list(sorted(A, reverse=True))

Amax = tmp[0]
Asecond = tmp[1]

for i in range(N):
    if A[i] != Amax:
        print(Amax)
    else:
        print(Asecond)
### BUGGY CODE ###


with open(0) as f:
    N = int(f.readline())
    A = [list(map(int, line.split())) for line in f.readlines()]

possible = True
ans = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(N):
            if k == i or k == j:
                continue
            if A[i][j] < A[i][k] + A[k][j]:
                continue
            elif A[i][j] == A[i][k] + A[k][j]:
                break
            else:
                possible = False
                break
        else:
            ans += A[i][j]
print(ans if possible else -1)

### FIXED CODE ###

def main():
    inf=float("inf")
    n=int(input())
    alst=[list(map(int,input().split())) for _ in range(n)]
 
    for i in range(n):
        alst[i][i]=inf
 
    sm=0
    token=0
 
    for i in range(n):
        for j in range(i+1,n):
            for k in range(n):
                if alst[i][k]+alst[k][j]>alst[i][j]:
                    continue
                elif alst[i][k]+alst[k][j]==alst[i][j]:
                    break
                else:
                    token=1
                    break
            else :
                sm+=alst[i][j]
    
    if token : sm=-1
 
    print(sm)
 
main()
### BUGGY CODE ###

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

for i in range(1,a+1):
  print(li.count(i))

### FIXED CODE ###

from collections import Counter

n = int(input())
li = input().split()
a = Counter(li)


for i in range(1,n+1):
  print(a[str(i)])
### BUGGY CODE ###

n,m=list(map(int,input().split()))
#チェックしたか
checked=[False]*n
#辺があるか（左が小さい）
matrix=[[False]*n for _ in range(n)]
for i in range(m):
  u,v,a=list(map(int,input().split()))
  matrix[u-1][v-1] = True

ans=0

#閉路があればFalse,なければTrue
#既にチェック済のところを踏んだら閉路
def check(c,pre):
  flg=True
  checked[c]=True
  for i in range(n):
    if pre != i and matrix[min(c,i)][max(c,i)]:
      if checked[i]:
        flg=False
  return flg

for i in range(n):
  if checked[i]==False:
    if check(i,-1):
      ans+=1
print(ans)


### FIXED CODE ###

import collections

n,m=list(map(int,input().split()))
#チェックしたか
checked=[False]*n
way=[[] for i in range(n)]
for i in range(m):
  x,y,z=list(map(int,input().split()))
  x-=1
  y-=1
  way[x].append(y)
  way[y].append(x)
ans=0

for i in range(n):
  if checked[i]==False:
    #木に繋がっているノードをチェック済にする
    q=collections.deque()
    q.append(i)
    while len(q)>0:
      c=q.popleft()
      for i in way[c]:
        if not checked[i]:
          checked[i]=True
          q.append(i)
    ans+=1
print(ans)
### BUGGY CODE ###

X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
res = []
for i in range(X):
  for j in range(Y):
    for k in range(Z):
      res.append(A[i] + B[j] + C[k])
res.sort()
for _ in range(K):
  print(res.pop())

### FIXED CODE ###

from bisect import bisect_left as bl
from collections import deque as dq
X, Y, Z, K = map(int, input().split())
ABC = [sorted(list(map(int, input().split()))) for _ in range(3)]
AB = []
for i in range(X):
  for j in range(Y):
    AB.append(ABC[0][i] + ABC[1][j])
AB.sort(reverse = True)
res = []
for i in range(min(K, X * Y)):
  for j in range(Z):
    res.append(AB[i] + ABC[2][j])
res.sort(reverse = True)
for i in range(K):
  print(res[i])
### BUGGY CODE ###

n = int(input())
A = list(map(int, input().split()))
counter = [0]*n
for i in range(n):
    counter[A[i]-1] += 1
 
counter_comb = list(map(lambda y: int(y*(y-1)/2), counter))
 
for i in range(n):
    z = counter[A[i]-1]
    if z>0:
        print(sum(counter_comb)-(z-1))
    else:
        print(sum(counter_comb))

### FIXED CODE ###

from collections import Counter

n = int(input())
A = list(map(int, input().split()))
counter = Counter(A)
counter_comb = list(map(lambda y: int(y*(y-1)/2), counter.values()))
sum_counter = sum(counter_comb)
for i in range(n):
    z = counter[A[i]]
    if z>0:
        print(sum_counter-(z-1))
    else:
        print(sum_counter)
### BUGGY CODE ###

from collections import deque
n = int(input())
d = deque([int(input()) for i in range(n)])

for _ in range(n):
    x = d.popleft()
    print(max(d))
    d.append(x)

### FIXED CODE ###

n = int(input())
t = [int(input()) for i in range(n)]
tt = sorted(t)
m = tt[-1]
mm = tt[-2]

for i in range(n):
    if t[i] == m:
        print(mm)
    else:
        print(m)
### BUGGY CODE ###

N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

t = 0
a, b, c, d, e = 0, 0, 0, 0, 0
n = N

while(True):
    t += 1
    # calc minus
    x1 = A if n > A else n
    x2 = B if a > B else a
    x3 = C if b > C else b
    x4 = D if c > D else c
    x5 = E if d > E else d

    n -= x1
    a -= x2
    b -= x3
    c -= x4
    d -= x5

    # calc add
    a += x1
    b += x2
    c += x3
    d += x4
    e += x5

    if e >= N:
        break

print(t)

### FIXED CODE ###

import math

N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

t = 0
a, b, c, d, e = 0, 0, 0, 0, 0
n = N

#while(True):
#    t += 1
#    # calc minus
#    x1 = A if n > A else n
#    x2 = B if a > B else a
#    x3 = C if b > C else b
#    x4 = D if c > D else c
#    x5 = E if d > E else d
#
#    n -= x1
#    a -= x2
#    b -= x3
#    c -= x4
#    d -= x5
#
#    # calc add
#    a += x1
#    b += x2
#    c += x3
#    d += x4
#    e += x5
#
#    if e >= N:
#        break
# print(t)

print(math.ceil(N / min([A, B, C, D, E])) + 4)
### BUGGY CODE ###

import numpy as np

N = int(input())
p = [0] + list(input().split())

for i in range(1, N+1):
    item = p[i].replace('0.', '')
    p[i] = int(item)

#print(p)

dp = np.zeros((3100, 3100))
#dp[i, j] = i枚目までのコインを投げて，表の個数がj枚である確率 * (10**(2*i))
#pythonのlistだと遅いので，numpyにおけるベクトル漸化式としてdpを埋めていく

dp[1, 0] = 100-p[1]
dp[1, 1] = p[1]

for i in range(2, N + 1):
    for j in range(i+1):
        dp[i] = (np.roll(dp[i-1], 1) * p[i] + dp[i-1] * (100-p[i])) // 10**max(0, i-10)
        #dp[i][j] = i-1枚目までで表がj-1かつi回目で表　＋　i-1回目までで表がj枚かつi回目で裏（MECE）
        #print(i, j, dp[i][j])
        #プログラムの仕組み上，iが一つ進むと，100 * 100 = 10**4　ずつスケールが大きくなっていく。10**20で打ち切る。


ans = 0

for k in range(-(-N//2), N+1):
    ans += dp[N, k]

dig = min(2*N, 10)

print(ans/10**dig)

### FIXED CODE ###

import numpy as np

N = int(input())
p = [0] + list(map(float, input().split()))

dp = np.zeros((3100, 3100))
#dp[i, j] = i枚目までのコインを投げて，表の個数がj枚である確率
#pythonのlistだと遅いので，numpyにおけるベクトル漸化式としてdpを埋めていく

dp[1, 0] = 1-p[1]
dp[1, 1] = p[1]

for i in range(2, N + 1):
    dp[i] = np.roll(dp[i-1], 1) * p[i] + dp[i-1] * (1-p[i])
    #dp[i][j] = i-1枚目までで表がj-1かつi回目で表　＋　i-1回目までで表がj枚かつi回目で裏（MECE）
    #つまり，dp[i][j] = dp[i-1][j-1] * p[i] + dp[i-1][j] * (1 - p[i])
    #numpyを使ってベクトル漸化式と見ることで，for_loopを一層分解消。
    #print(i, j, dp[i][j])

ans = 0

for k in range(-(-N//2), N+1):
    ans += dp[N, k]

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

from bisect import bisect_left, bisect_right
import sys
import numpy as np
input = sys.stdin.readline
N,D,A=map(int, input().split())
mg = [None]*N
X = [None]*N
H = [None]*N
XD = [None]*N
for i in range(N):
  mg[i]=list(map(int, input().split()))
mg.sort(key=lambda x:x[0])
mg = (np.array(mg)).T
X = mg[0]
H = mg[1]
for i in range(N):
  XD[i] = bisect_right(X,X[i]+2*D)
XD = np.array(XD)
i = 0
ans = 0
while i<N:
  if H[i]>0:
    k = (H[i]+A-1)//A
    ans +=k
    H[i:XD[i]]=np.maximum(0,H[i:XD[i]]-k*A)
  i+=1
print(ans)

### FIXED CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-

from bisect import bisect_left, bisect_right

n, d, a = map(int, input().split())
x = []
xh = dict()
for _ in range(n):
    xi, hi = map(int, input().split())
    x.append(xi)
    xh[xi] = hi
x.sort()

l = 0
ret = 0
ai = [0] * (n+1)
anow = 0
while l < n:
    xl = x[l]
    hl = xh[xl]
    anow += ai[l]
    hl -= a * anow
    if hl > 0:
        r = bisect_right(x, xl+2*d)
        k = (hl+(a-1))//a
        ret += k
        anow += k
        ai[r] -= k
    l += 1
print(ret)
### BUGGY CODE ###

N = int(input())
C = input()
C = C.lstrip('R').rstrip('W')

i = 0
while len(C) > 0:
    l = C.index('R')
    r = C[::-1].index('W')
    n = min(l, r)
    C = C[n:-n]
    C = C.lstrip('R').rstrip('W')
    i += n
else:
    print(i)

### FIXED CODE ###

N = int(input())
C = input()

l, r = 0, N - 1
ans = 0
while l < r:
    if C[l] == 'R':
        l += 1
    elif C[r] == 'W':
        r -= 1
    else:
        ans += 1
        l += 1
        r -= 1
print(ans)
### BUGGY CODE ###

num = int(input())
original = list(map(int, input().split()))
trial_num = int(input())

total = sum(original)
now_list = original

for i in range(trial_num):
    trial = list(map(int, input().split()))
    count = 0
    for i in range(num):
        if now_list[i] == trial[0]:
            now_list[i] = trial[1]
            count += 1
    total += (trial[1] - trial[0]) * count
    print(total)
    

### FIXED CODE ###

import collections

num = int(input())
original = list(map(int, input().split()))
trial_num = int(input())

total = sum(original)
# now_list = original
count_dict = collections.Counter(original)

for i in range(trial_num):
    b, c = list(map(int, input().split()))
    total += (c - b) * count_dict[b]
    print(total)
    
    if c in count_dict.keys():
        count_dict[c] += count_dict[b]
    else:
        count_dict[c] = count_dict[b]
    count_dict[b] = 0
### BUGGY CODE ###

s = input()
s_num = int(s)
len_s = len(s)
count = 0
for i in range(4,len_s):
    for j in range(len_s-i+1):
        if int(s[j:i+j])%2019==0:
            count+=1
print(count)

        

### FIXED CODE ###

s=list(input())
s.reverse()
s_len = len(s)

list = [0 for _ in range(2019)]
ans = 0
mod = 2019
li = [0]
digit = 0
for i in range(s_len):
    li.append((li[i] + int(s[i])*pow(10,digit,mod))%mod)
    digit+=1
for i in range(s_len+1):
    list[li[i]]+=1
for i in range(2019):
    x = list[i]
    ans += x*(x-1)/2
print(int(ans))
### BUGGY CODE ###

nn=int(input())
n=10**5+1
a=[0]*n
a[1]=0
ans=1
pre=1
if nn==1:
    print(1)
else:
        
    for i in range(2,n):
        if a[i]==0:
    
            if i>=nn:
                print(i)
                break
            pre =ans
            ans=i
            
            for j in range(i+1,n):
                #print(i,j,a[j])
                if j%i==0:
                    a[j]=1
                    #print("asdf",i,j,a[j])
    """
    for i in range(nn,n):
        if a[i]==0:
            print(i)
    
            
                    
                    
    """             

### FIXED CODE ###

nn=int(input())
n=10**5+100
ar=[0]*(n)
ar[1]=0
ans=0
pre=1
for i in range(2,n):
    if ar[i]==0:

        for j in range(2*i,n,i):
            ar[j]=1
ans=1
if ar[nn]==0:
    print(nn)
else:
        
    for i in range(nn,n):
        if ar[i]==0:
            print(i)
            break
### BUGGY CODE ###

import numpy as np
n, k = map(int, input().split())
arr = np.array([int(i) for i in input().split()])
max = 0
max_p = 0

for i in range(0, n-k+1):
  t = sum(arr[i:i+k])
  if max < t:
    max = t
    max_p = sum([_*(_+1)/(_*2.0) for _ in arr[i:i+k]])

print(max_p)

### FIXED CODE ###

import numpy as np
n, k = map(int, input().split())
arr = np.array([int(_)*(int(_)+1)/(int(_)*2.0) for _ in input().split()])

max = t = sum(arr[0:k])

for i in range(1, n-k+1):
  t += arr[i+k-1]
  t -= arr[i-1]
  if max < t:
    max = t

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

import sys
input = sys.stdin.readline

n, W = map(int, input().split())
dp = [[float("inf")] * (1010 * (n + 1)) for _ in range(n + 1)]

dp[0][0] = 0
v_max = 0
for i in range(n):
    w, v = map(int, input().split())
    for j in range(i, -1, -1):
        for k in range(v_max + 1):
            dp[j + 1][k + v] = min(dp[j][k] + w, dp[j + 1][k + v])
    v_max += v

ans = 0
for i in range(n + 1):
    for j in range(v_max + 1):
        if dp[i][j] <= W:
            ans = max(ans, j)
print(ans)

### FIXED CODE ###

n, W = map(int, input().split())
dp = [W + 1] * (1010 * (n + 1))

dp[0] = 0
v_max = 0
for i in range(n):
    w, v = map(int, input().split())
    v_max += v
    for j in range(v_max, v - 1, -1):
        dp[j] = min(dp[j - v] + w, dp[j])

ans = 0
for i in range(v_max, -1, -1):
    if dp[i] <= W:
        ans = max(ans, i)
print(ans)
### BUGGY CODE ###

N, M = map(int,input().split())
list_and = list(range(1,N+1,1))
for i in range(M):
    L, R = list(map(int, input().split()))
    list_temp = list(range(L,R+1,1))
    list_and = set(list_and) & set(list_temp)
print(len(list_and))

### FIXED CODE ###

n, m = map(int, input().split())
l = 0
r = n
for _ in range(m):
    nl, nr = map(int, input().split())
    l = max(nl, l)
    r = min(nr, r)
 
print(max(r - l + 1, 0))
### BUGGY CODE ###

n= int(input())
l = []
for _ in range(n):
    l.append(''.join(sorted(input())))

cnt = 0
for idx, e in enumerate(l):
    ll = l[idx+1:]
    for ee in ll:
        if e == ee:
            cnt += 1

print(cnt)

### FIXED CODE ###

n= int(input())
l = []
for _ in range(n):
    l.append(''.join(sorted(input())))

d = dict()
cnt = 0
for e in l:
    if e in d:
        d[e] += 1
        cnt += d[e]
    else:
        d[e] = 0

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

L = int(input())

#頂点の数nを決める
n = 0
while 2**n < L:
    n += 1
    
side_lst = []
for i in range(1, n):
    side_lst.append([i, i+1, 0])
    side_lst.append([i, i+1, 2**(i-1)])

rest = L - 2**(n-1)
next_num = 2**(n-1)
#print('rest :', rest, 'next_num :', next_num)

m = n
while rest > 0:
    if rest >= 2**(m-2):
        side_lst.append([m-1, n, next_num])
        next_num += 2**(m-2)
        rest -= 2**(m-2)
    m -= 1
    #print('rest :', rest, 'next_num :', next_num)
    
print(n, len(side_lst))
for i in side_lst:
    print(i[0], i[1], i[2])

### FIXED CODE ###

L = int(input())

n = 0
while 2**n <= L:
    n += 1

side_lst = []
    
rest = L - 2**(n-1)
next_num = 2**(n-1)

m = n
while rest > 0:
    if rest >= 2**(m-2):
        side_lst.append([m-1, n, next_num])
        next_num += 2**(m-2)
        rest -= 2**(m-2)
    m -= 1
    
print(n, len(side_lst)+(n-1)*2)
for i in side_lst:
    print(i[0], i[1], i[2])
    
for i in range(1, n):
    print(i, i+1, 0)
    print(i, i+1, 2**(i-1))
### BUGGY CODE ###

import fractions

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

# 1は絶対入る
cd = [1]
answer = 1
if A%2 == 0 and B%2 == 0:
    cd.append(2)
    answer += 1
for i in range(3, fractions.gcd(A, B)+1, 2):
    if A%i == 0 and B%i == 0:
        for j in cd:
            if fractions.gcd(i, j) != 1:
                break
        else:
            cd.append(i)
            answer += 1
            
print(answer)

### FIXED CODE ###

import fractions

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

GCD = fractions.gcd(A, B)

def pf(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

print(len(set(pf(GCD))) + 1)
### BUGGY CODE ###

n = int(input())
lis = []
ans = 0
for i in range(n):
    s = input()
    key = []
    val = []
    for j in range(10):
        cnt = 1
        if s[j] not in key and j < 9:
            for k in range(j+1,10):
                if s[j] == s[k]:
                    cnt += 1
            key.append(s[j])
            val.append(cnt)
        elif j == 9:
            if s[j] not in key:
                key.append(s[j])
                val.append(cnt)
    d = dict(zip(key, val))
    lis.append(d)
    if n > 0:
        for l in range(len(lis)-1):
            if lis[-1] == lis[l]:
                ans += 1

print(ans)

### FIXED CODE ###

n = int(input())
ans = 0
dic = {}
for i in range(n):
    sorted_s = sorted(input())
    s = ""
    for j in range(10):
        s = s + sorted_s[j]
    
    if s not in dic:
        dic[s] = 1
    else:
        ans += dic[s]
        dic[s] = dic[s] + 1
print(ans)
### BUGGY CODE ###

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

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

t = 0
k= int(input(''))+1
for l in range(1,k):
    for m in range(1,k):
        for n in range(1,k):
            t+= gcd_list([l,m,n])
#            print("{}/{}/{} -> {}".format(l,m,n,gcd(l,m,n)))

print(t)


### FIXED CODE ###

import math
from functools import reduce
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
def gcd_list(numbers):
    return reduce(math.gcd, numbers)

t = 0
k= int(input(''))+1

#cnt={}

for l in range(1,k):
    for m in range(l,k):
        for n in range(m,k):
#            print("{}/{}/{}".format(l,m,n))
#            key = '-'.join(map(str,sorted([l,m,n])))
#            if not key in cnt.keys():
#                cnt[key] = 0
#            cnt[key]+=1
            if l==m and l==n:
                t+= gcd_list([l,m,n])
#                print("{}/{}/{} -> {} a".format(l,m,n,gcd(l,m,n)))
            elif l==m or l==n or m ==n:
                t+= gcd_list([l,m,n])*3
#                print("{}/{}/{} -> {} b".format(l,m,n,gcd(l,m,n)))
            elif l!=m and m!=n:
                t+= gcd_list([l,m,n])*6
#                print("{}/{}/{} -> {} c".format(l,m,n,gcd(l,m,n)))

#for a,b in cnt.items():
#    print("{} -> {}".format(a,b))
print(t)
### BUGGY CODE ###

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

i = 1
while i in a:
  a[0:a.index(i)+1] = []
  i += 1

ans = N - i + 1
if i == 1:
  ans = -1
print(ans)

### FIXED CODE ###

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

ans, nxt = 0, 1

for i in range(N):
  if a[i] == nxt:
    nxt += 1
  else:
    ans += 1

if ans == N:
  ans = -1

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

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

dp = [0] * (max(A)+1)

for a in A:
    dp[a] += 1

ans = 0

for i in range(max(A)+1):
    if dp[i] == 1:
        ans += 1
    if dp[i] != 0:
        for j in range(2*i, max(A)+1, i):
            if dp[j] != 0:
                dp[j] += 1

print(ans)

### FIXED CODE ###

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

LIST=[0]*(10**6+1)

for a in A:
    LIST[a]+=1
ANS=0

for i in range(10**6+1):
    if LIST[i]==1:
        ANS+=1
    if LIST[i]!=0:
        for j in range(2*i,10**6+1,i):
            if LIST[j]!=0:
                LIST[j]+=1
print(ANS)
### BUGGY CODE ###

def furui(n):
  data = [i for i in range(2, 2*n)]
  ans = []
  while True:
    sentou = data[0]
    if sentou >= n:
      return sentou
    ans.append(sentou)
    data = [i for i in data[1:] if i % sentou != 0]

x = int(input())
print(furui(x))


### FIXED CODE ###

import math
def is_sosu(n):
  for i in range(2, math.floor(math.sqrt(n))+1):
    if n % i == 0:
      return False
  return True

x = int(input())
for i in range(x, x*2):
  if is_sosu(i):
    print(i)
    exit()
### BUGGY CODE ###

N = int(input())
a = list(map(int, input().split()))
count = 0

for i in range(N):
    if a[i] == 1:
        count += i
        k = i
        break
    elif min(a) >= 2:
        print(-1)
        exit()
        
M = 2

for i in range(k+1, N):
    if a[i] != M:
        count += 1
    else:
        M+= 1
        

print(count)        

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
count = 0

if min(a) >= 2:
        print(-1)
        exit()

for i in range(N):
    if a[i] == 1:
        count += i
        k = i
        break

M = 2

for i in range(k+1, N):
    if a[i] != M:
        count += 1
    else:
        M+= 1
        

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

import heapq
def SME():
    A = []
    C = set([i for i in range(N)])
    D = set([])
    parameter = 0.99
    count = 0
    ANS = [heapq.heappush(A,[x,i]) for i,x in enumerate(Whole)]
    for j in range(N) :
        a = heapq.heappop(A)
        for i in range(L):
            idx = a[1] + i
            try :
                if ANS[idx] : continue
                else :
                    ANS[idx] = a[0]
                    D.add(idx)
                    count += 1
            except IndexError : continue
        if count > N * parameter : break
    for i in C.difference(D):
        if i < L : ANS[i] = min(Whole[:i+1])
        else : ANS[i] = min(Whole[i+1-L:i+1])
    return ANS

[N,L] = [int(x) for x in input().split()]
Whole = [int(x) for x in input().split()]
ANS = SME()
for i in ANS[L-1:-1]:print(i, end=" ")
print(ANS[-1])

### FIXED CODE ###

def ascend(a,b):
    mini = min(A[a:a+L])
    ans[a] = mini
    for i in range(a+1,b):
        if A[i+L-1] <= mini : mini = A[i+L-1]
        elif A[i-1] == mini : mini = min(A[i:i+L])
        ans[i] = mini

def descend(a,b):
    mini = min(A[b-1:b+L-1])
    ans[b-1] = mini
    for i in range(b-2,a-1,-1):
        if A[i] <= mini : mini = A[i]
        elif A[i+L] == mini: mini = min(A[i:i+L])
        ans[i] = mini
    
[N,L] = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ans = [None]*(N-L+1)
count = 0;
if N > 10 ** 4:
    for i in range(100):
        if A[i+1] > A[i] : count += 1
    if count > 80 : descend(0, N-L+1)
    else : ascend(0,N-L+1)
else :
    ascend(0, N-L+1)
for i in ans[:-1] : print(i, end=" ")
print(ans[-1])
### BUGGY CODE ###

n = int(input())

power = 1
for n_i in range(1, n+1):
    power *= n_i
print(power%1000000007)

### FIXED CODE ###

import math

n = int(input())

print(math.factorial(n)%1000000007)