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

import copy
import collections

n = int(input())
a = list(map(int, input().split()))
b = collections.Counter(a)
c = b.most_common()
values, counts = zip(*b.most_common())
d = (counts)
ans = 0

for j in range(len(d)):
    f = d[j]
    ans = ans + (f*(f - 1)/2)

for i in range(n):
    g = a[i]
    gc = a.count(g)
    tem = ans - gc + 1
    print(int(tem))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = [0]*n
ans = 0

for i in range(n):
    b[a[i] - 1] += 1

for i in range(n):
    ans += b[i]*(b[i] - 1)//2

for i in range(n):
    print(ans - b[a[i] -1] + 1)
### BUGGY CODE ###

n,m=map(int,input().split())
a=list(int(input())for _ in range(m))
count=list(0 for _ in range(n+1))
ans=0
if n==1:
    ans=1
else:
    if 1 not in a:
        count[1]=1
    if 2 not in a:
        count[2]=count[1]+1
    for i in range(3,n+1):
        if i not in a:
            count[i]=count[i-1]+count[i-2]
            
    ans=count[n]
print(ans%(10**9+7))
           

### FIXED CODE ###

n,m=map(int,input().split())
flag=list(1 for _ in range(n+1))
count=list(0 for _ in range(n+1))
ans=0
for i in range(m):
    x=int(input())
    flag[x]=0

if n==1:
    ans=1
else:
    if flag[1]==1:
        count[1]=1
    if flag[2]==1:
        count[2]=count[1]+1
    for i in range(3,n+1):
        if flag[i]==1:
            count[i]=count[i-1]+count[i-2]
            
    ans=count[n]
print(ans%(10**9+7))
### BUGGY CODE ###

s = input()

n = len(s)
amari = [0] * 2019
amari[0] += 1
tmp = ""
for i in range(1, n + 1):
    tmp = s[-i] + tmp
    amari[int(tmp) % 2019] += 1

ans = 0
for i in amari:
    ans += i * (i - 1) // 2

print(ans)

### FIXED CODE ###

s = input()

n = len(s)
amari = [0] * 2019
amari[0] += 1
tmp = 0
digit = 1
for i in range(n):
    tmp += int(s[n-i-1]) * digit
    tmp %= 2019
    amari[tmp] += 1
    digit = (digit * 10) % 2019

ans = 0
for i in amari:
    ans += i * (i - 1) // 2

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

n, q = map(int, input().split())
s = input()
ans = []
for i in range(q):
    counter = 0
    l, r = map(int,input().split())
    for i in range(r - l):
        if s[i + l - 1] + s[i + l] == "AC":
            counter += 1
    ans.append(counter)
for i in ans:
    print(i)

### FIXED CODE ###

N,Q=map(int,input().split())
S=input()
count=[0]*N
for i in range(1,N):
    count[i]+=count[i-1]
    if S[i-1:i+1]=="AC":count[i]+=1
for i in range(Q):
    l,r=map(int,input().split())
    print(count[r-1]-count[l-1])
### BUGGY CODE ###

import queue
height,width=map(int,input().split())

graph=[input() for _ in range(height)]

dxs = [0, 0, 1, -1]
dys = [1, -1, 0, 0]
max_step=[]
for h in range(height):
    for w in range(width):
        if graph[h][w]=='#':
            continue

        route = [[-1]*width for _ in range(height)]

        # start x,y,経路数
        q = queue.Queue()
        q.put([w,h,0])

        while not q.empty():
            nx,ny,nn = q.get()
            route[ny][nx] = nn

            for dx,dy in zip(dxs, dys):
                x = nx+dx
                y = ny+dy
                if   width<=x \
                  or height<=y \
                  or x < 0 \
                  or y < 0 \
                  or graph[y][x]=='#' \
                  or route[y][x]!=-1:
                    continue
                q.put([x, y, nn+1])
        
        max_step.append(max(max(step) for step in route))
        
print(max(max_step))

### FIXED CODE ###

import queue
height,width=map(int,input().split())

graph=[input() for _ in range(height)]

dxs = [0, 0, 1, -1]
dys = [1, -1, 0, 0]
max_step=[]
for h in range(height):
    for w in range(width):
        if graph[h][w]=='#':
            continue

        route = [[-1]*width for _ in range(height)]
        route[h][w] = 0

        # start x,y,経路数
        q = queue.Queue()
        q.put([w,h,0])

        while not q.empty():
            nx,ny,nn = q.get()

            for dx,dy in zip(dxs, dys):
                x = nx+dx
                y = ny+dy
                if   width<=x \
                  or height<=y \
                  or x < 0 \
                  or y < 0 \
                  or graph[y][x]=='#' \
                  or route[y][x]!=-1:
                    continue
                route[y][x] = nn + 1
                q.put([x, y, nn+1])
        
        max_step.append(max(max(step) for step in route))
        
print(max(max_step))
### BUGGY CODE ###

n, k = map(int, input().split())
h_list = list(map(int, input().split()))
costs = [0] * n
costs[1] = abs(h_list[0] - h_list[1])
start = 0
for i in range(2, n):
    tmp = []
    v = h_list[i]
    if i-k >= 0:
        start = i-k
    else:
        start = 0
    for l in range(start, i):
        tmp.append(abs(v - h_list[l])+costs[l])
    costs[i] = min(tmp)
print(costs[-1])


### FIXED CODE ###

n, k = map(int, input().split())
h_list = list(map(int, input().split()))
costs = [0] * n
costs[1] = abs(h_list[0] - h_list[1])
start = 0
for i in range(2, n):
    tmp = []
    v = h_list[i]
    start = max(0, i-k)
    costs[i] = min(abs(v - h_j) + c for h_j, c in zip(h_list[start:i], costs[start:i]))
    # for l in range(start, i):
    #     tmp.append(abs(v - h_list[l])+costs[l])
    #     if abs(v - h_list[l]) == 0:
    #         break
    # costs[i] = min(tmp)
print(costs[-1])
### BUGGY CODE ###

N,W = map(int,input().split())
goods = [list(map(int,input().split())) for _ in range(N)]

dp = [[0 for _ in range(W)] for _ in range(N)]

for i,[w,v] in enumerate(goods):
  for j in range(W):
    if i == 0:
      if j >= goods[0][0]-1:
        dp[0][j] = goods[0][1]
    else:
      if w <= j:
        dp[i][j] = max(v+dp[i-1][j-w],dp[i][j-1],dp[i-1][j])
      else:
        dp[i][j] = max(dp[i-1][j],dp[i][j-1])

print(dp[N-1][W-1])

### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
  
  def knapsack_price(single=True):
    V = sum(price_list)
    dp_max = W + 1
    dp = [dp_max] * (V+1)
    dp[0] = 0
    
    for i in range(N):
      if single:
        S = list(reversed(range(price_list[i], V+1)))
      else:
        S = list(range(price_list[i], V+1))
      for price in S:
        dp[price] = min(dp[price], dp[price - price_list[i]] + weight_list[i])
    
    return max(price for price in range(V+1) if dp[price] <= W)
  
  N,W = map(int,input().split())
  
  price_list = []
  weight_list = []
  for _ in range(N):
    weight, price = map(int,input().split())
    price_list.append(price)
    weight_list.append(weight)
    
  print(knapsack_price(single=True))

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

import re
import sys

n = int(input())
c = list(input())

count_r = 0
for i in c:
    if i == 'R':
        count_r += 1
count_w = n - count_r
ans = min(count_r, count_w)
if ans == 0:
    print(0)
    sys.exit()

pattern = r"^R*W*$"
# print(re.fullmatch(pattern, "RRRWW"))
# print(re.search(pattern, "RRRWW"))
l = 0
r = n-1
count = 0
while not re.match(pattern, ''.join(c)):
# while l < r:
    while c[l] == 'R':
        l += 1
    while c[r] =='W':
        r -= 1
    c[l] = 'R'
    c[r] = 'W'
    count += 1
    # print(c, l, r)
    # if l == r-1:
    #     break

ans = min(count, ans)

print(ans)

### FIXED CODE ###

import re
import sys

n = int(input())
c = list(input())

count_r = 0
for i in c:
    if i == 'R':
        count_r += 1
count_w = n - count_r
ans = min(count_r, count_w)
if ans == 0:
    print(0)
    sys.exit()

pattern = r"^R*W*$"
# print(re.fullmatch(pattern, "RRRWW"))
# print(re.search(pattern, "RRRWW"))
l = 0
r = n-1
count = 0
# while not re.match(pattern, ''.join(c)):
while l < r:
    while c[l] == 'R':
        l += 1
    while c[r] =='W':
        r -= 1
    if l >= r:
        break
    c[l] = 'R'
    c[r] = 'W'
    count += 1
    # print(c, l, r)
    

ans = min(count, ans)

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

n, x, y = [int(i) for i in input().split()]
x, y = [x - 1, y - 1]

def shortest_dist(a, b):
    return min(min(abs(a - b), abs(a - x) + 1 + abs(b - y)), abs(a - x) + 2 + abs(b - x))

distance = [0] * n
for i in range(n):
    for j in range(i+1, n):
        distance[shortest_dist(i, j)] += 1

for i in range(1,n):
    print(distance[i])


# abs(a - b)
# abs(a - x) + 1 + abs(b - y)
# abs(a - x) + 2 + abs(b - x) 
# ↑のうち最小

### FIXED CODE ###

n, x, y = [int(i) for i in input().split()]
x, y = [x - 1, y - 1]

def shortest_dist(a, b):
    return min(min(abs(a - b), abs(a - x) + 1 + abs(b - y)), abs(a - x) + 2 + abs(b - x))

distance = [0] * n
for i in range(n):
    for j in range(i+1, n):
        distance[shortest_dist(i, j)] += 1

for i in range(1,n):
    print(distance[i])


# abs(a - b)
# abs(a - x) + 1 + abs(b - y)
# abs(a - x) + 2 + abs(b - x) 
# ↑のうち最小
### BUGGY CODE ###

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

for i in range (K):
	if A >= 1:
		A = A-1
	elif A == 0 and B >= 1:
		B = B-1

print (str(A) + ' ' + str(B))

### FIXED CODE ###

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

if K>=A + B:
	print ("0 0")
elif K>=A:
	print (str(0) + ' ' + str(B-(K-A)))
else:
  	print (str(A-K) + ' ' +str(B))
### BUGGY CODE ###

import collections as col
N = int(input())
l = [input() for _ in range(N)]
count = 0
for i in range(N):
    c = col.Counter(str(l[i]))
    for j in range(i+1, N):
        d = col.Counter(str(l[j]))
        if c == d:
            count += 1
print(count)

### FIXED CODE ###

N = int(input())
l = [input() for _ in range(N)]
ans = 0
dic = {}
for n in range(N):
    new = sorted(l[n])
    if not str(new) in dic:
        count = 1
        dic[str(new)] = count
    else:
        ans += dic[str(new)]
        dic[str(new)] += 1
print(ans)
### BUGGY CODE ###

n, m = map(int, input().split())
d = {}
ans = [0] * (n)
for _ in range(m):
    a, b = map(int, input().split())
    if not a in d.keys():
        d[a] = [b]
    else:
        d[a].append(b)
    if not b in d.keys():
        d[b] = [a]
    else:
        d[b].append(a)
    if a == 1:
        ans[b-1] = 1
    if b == 1:
        ans[a-1] = 1

q = [1]
alr = [1]
while not len(q) == 0:
    x = q.pop(0)
    for i in d[x]:
        if ans[i-1] == 0:
            ans[i-1] = x
        if i in alr:
            continue
        alr.append(i)
        q.append(i)
if 0 in ans:
    print('No')
else:
    print('Yes')
    for j in range(1, n):
        print(ans[j])

### FIXED CODE ###

from collections import deque
n, m = map(int, input().split())
d = [[] for _ in range(n+1)]
ans = [0] * (n)
for _ in range(m):
    a, b = map(int, input().split())
    d[a].append(b)
    d[b].append(a)

q = deque([1])
while not len(q) == 0:
    x = q.popleft()
    for i in d[x]:
        if ans[i-1] == 0:
            ans[i-1] = x
            q.append(i)

if 0 in ans:
    print('No')
else:
    print('Yes')
    s  = "\n".join(map(str, ans[1:]))
    print(s)
### BUGGY CODE ###

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 2*10**6+2
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 )

r1,c1,r2,c2=map(int,input().split())

print((cmb(r2+c2+2,c2+1,mod)+cmb(r1+c1,r1,mod)-cmb(r1+c2+1,c2+1,mod)-cmb(r2+c1+1,c1,mod))%mod)

### FIXED CODE ###

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 2*10**6+2
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 )

r1,c1,r2,c2=map(int,input().split())

print((cmb(r2+c2+2,c2+1,mod)+cmb(r1+c1,r1,mod)-cmb(r1+c2+1,c2+1,mod)-cmb(r2+c1+1,c1,mod))%mod)
### BUGGY CODE ###

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

for i in range(N):
    B = sorted(A[0:i] + A[i+1:N])
    s = 0
    for j in range(s,len(B)):
        for k in range(j+1,len(B)):
            if B[j] == B[k]:
                s += 1
            else:
                break
    print(s)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
c = {}
for k in range(N):
    if c.get(A[k]) is None:
        c[A[k]] = 1
    else:
        c[A[k]] += 1

x = 0
for i in c:
    x += c[i]*(c[i]-1)//2
for i in range(N):
    print(x+1-c[A[i]])
### BUGGY CODE ###

def judge(n):
    if n < 2:
        return False
    if n == 2 or n == 3 or n == 5 or n == 7 or n == 11 or n == 13 or n == 17:
        return True
    if n % 2 == 0 or n % 3 == 0 or n % 5 == 0 or n % 7 == 0 or n % 11 == 0 or n % 13 == 0 or n % 17 == 0:
        return False
    i = 23
    while i < n:
        if n % i == 0:
            return False
        i += 1
    return True


N = int(input())
count = 0
for i in range(N):
    if (judge(int(input())) == True):
        count += 1

print(count)

### FIXED CODE ###

import math


def judge(n):
    if n < 2:
        return False
    i = 2
    while i <= math.sqrt(n):
        if n % i == 0:
            return False
        i += 1
    return True


count = 0
n = int(input())
for i in range(n):
    if judge(int(input())):
        count += 1
print(count)
### BUGGY CODE ###

s = input()
t = input()
ls = len(s)
lt = len(t)
DP_len = [[0] * (lt+1) for i in range(ls+1)]
DP = [[''] * (lt+1) for i in range(ls+1)]
for i in range(1, ls+1):
    for j in range(1, lt+1):
        if s[i-1] == t[j-1]:
            if (DP_len[i-1][j-1] + 1 >= DP_len[i][j-1]) and (DP_len[i-1][j-1] + 1 >= DP_len[i-1][j]):
                DP[i][j] = DP[i-1][j-1] + s[i-1]
                DP_len[i][j] = DP_len[i - 1][j - 1] + 1
            else:
                if (DP_len[i-1][j] >= DP_len[i][j-1]) and (DP_len[i-1][j] >= DP_lenDP[i][j]):
                    DP[i][j] = DP[i-1][j]
                    DP_len[i][j] = DP_len[i - 1][j]
                elif (DP_len[i-1][j] <= DP_len[i][j-1]) and (DP_len[i][j-1] >= DP_len[i][j]):
                    DP[i][j] = DP[i][j-1]
                    DP_len[i][j] = DP_len[i][j-1]
        else:
            if (DP_len[i - 1][j] >= DP_len[i][j - 1]) and (DP_len[i - 1][j] >= DP_len[i][j]):
                DP[i][j] = DP[i - 1][j]
                DP_len[i][j] = DP_len[i - 1][j]
            elif (DP_len[i - 1][j] <= DP_len[i][j - 1]) and (DP_len[i][j - 1] >= DP_len[i][j]):
                DP[i][j] = DP[i][j - 1]
                DP_len[i][j] = DP_len[i][j - 1]

print(DP[ls][lt])



### FIXED CODE ###

from collections import deque

s = input()
t = input()
ls = len(s)
lt = len(t)
DP_len = [[0] * (lt + 1) for i in range(ls + 1)]
Prev =[[0] * (lt + 1) for i in range(ls + 1)]
for i in range(1, ls + 1):
    for j in range(1, lt + 1):
        if s[i - 1] == t[j - 1]:
            if max(DP_len[i - 1][j - 1] + 1, DP_len[i][j - 1], DP_len[i - 1][j]) == DP_len[i-1][j-1] + 1:
                DP_len[i][j] = DP_len[i-1][j-1] + 1
                Prev[i][j] = (i-1, j-1)
            else:
                if DP_len[i][j - 1] >= DP_len[i - 1][j]:
                    DP_len[i][j] = DP_len[i][j - 1]
                    Prev[i][j] = (i, j - 1)
                else:
                    DP_len[i][j] = DP_len[i - 1][j]
                    Prev[i][j] = (i - 1, j)

        else:
            if DP_len[i][j - 1] >= DP_len[i - 1][j]:
                DP_len[i][j] = DP_len[i][j - 1]
                Prev[i][j] = (i, j-1)
            else:
                DP_len[i][j] = DP_len[i - 1][j]
                Prev[i][j] = (i - 1, j)

x = ls
y = lt
ans = ''
while True:
    if x == 0 or y == 0:
        break
    nx, ny = Prev[x][y]
    if (nx != x) and (ny != y):
        ans = s[x-1] + ans
    x = nx
    y = ny
print(ans)
### BUGGY CODE ###

import sys
import numpy as np
from collections import deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

H, W = map(int, readline().split())
S = np.array([list(readline().decode('utf-8').rstrip()) for _ in range(H)])


def adjacent_4(h, w):
    ret = []
    for (dh, dw) in [(0, 1), (1, 0), (0, -1), (-1, 0)]:
        h_ = h + dh
        w_ = w + dw

        if (0 <= h_) & (h_ < H) & (0 <= w_) & (w_ < W):
            ret.append((h_, w_))
    return ret


def bfs(S, h, w):

    visited = np.full(S.shape, 10**9)
    visited[h][w] = 1

    que = deque()
    que.append((h, w))

    while len(que) != 0:
        pos = que.popleft()
        acc = visited[pos[0]][pos[1]]

        for adj in adjacent_4(pos[0], pos[1]):
            if S[adj[0]][adj[1]] == '#':
                continue
            acc_ = acc + 1
            if acc_ >= visited[adj[0]][adj[1]]:
                continue
            visited[adj[0]][adj[1]] = acc_
            que.append(adj)

    visited[visited == 10**9] = 0
    return visited.max() - 1


"""
ans = 0
for h in range(H):
    for w in range(W):
        if S[h][w] == '#':
            continue
        ans = max(ans, bfs(S, h, w))
"""
ans = max(bfs(S, h, w) for h in range(H) for w in range(W) if S[h][w] != '#')
print(int(ans))

### FIXED CODE ###

import sys
import numpy as np
from collections import deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

H, W = map(int, readline().split())
S = [list(readline().decode('utf-8').rstrip()) for _ in range(H)]


def adjacent_4(h, w):
    ret = []
    for (dh, dw) in [(0, 1), (1, 0), (0, -1), (-1, 0)]:
        h_ = h + dh
        w_ = w + dw

        if (0 <= h_) & (h_ < H) & (0 <= w_) & (w_ < W):
            ret.append((h_, w_))
    return ret


def bfs(S, h, w):

    visited = [[10**9] * W for _ in range(H)]
    visited[h][w] = 1

    que = deque()
    que.append((h, w))

    while len(que) != 0:
        h_, w_ = que.popleft()
        acc = visited[h_][w_]

        for adj_h, adj_w in adjacent_4(h_, w_):
            if S[adj_h][adj_w] == '#':
                continue
            acc_ = acc + 1
            if acc_ >= visited[adj_h][adj_w]:
                continue
            visited[adj_h][adj_w] = acc_
            que.append((adj_h, adj_w))

    return max(visited[h][w] for h in range(H)
               for w in range(W) if visited[h][w] != 10**9) - 1


"""
ans = 0
for h in range(H):
    for w in range(W):
        if S[h][w] == '#':
            continue
        ans = max(ans, bfs(S, h, w))
"""
ans = max(bfs(S, h, w) for h in range(H) for w in range(W) if S[h][w] != '#')
print(int(ans))
### BUGGY CODE ###

n = int(input())
v = list(map(int,input().split()))
odd = []
even = []
for i in range(n):
    if i%2 == 0:
        even.append(v[i])
    else:
        odd.append(v[i])
def count(aaa):
    if len(set(aaa))!=1:
        aaa_min = min(aaa,key = aaa.count)
    else:
        aaa_min = 0
    return int(aaa_min)
if len(set(v))==1:
    print(int(n/2))
else:
    even_min = count(even)
    odd_min = count(odd)
    print(even_min+odd_min)

### FIXED CODE ###

from collections import Counter
 
n = int(input())
v = list(map(int,input().split()))
ac = Counter(v[::2]).most_common(2)
bc = Counter(v[1::2]).most_common(2)


if ac[0][0] != bc[0][0]:           
    ans =  n - ac[0][1] - bc[0][1] 
else:                               
    if len(bc) == 1 or len(ac) == 1:
        ans = n // 2
    else: 
        ans = n - max(ac[0][1] + bc[1][1], ac[1][1] + bc[0][1])
print(ans)
### BUGGY CODE ###

from collections import Counter
n=int(input())#
*a,=map(int, input().split())
sa=Counter(a)

# def fct(x):
#     f1=[1]
#     f2=[]
#     for i in range(2,min(int(x**(1/2)+7),x)):
#         if x%i==0:
#             f1.append(i)
#             f2.append(x//i)
#     return (set(f1+f2))
ans=0
for ai in sa:
    if sa[ai]>1:
        continue
    
    ad=True

    for i in range(1,min(int(ai**(1/2)+7),ai)):
        if ai%i==0:
            if i in sa and i!=ai:
                ad=False
                break
            if i>1 and ai//i in sa:
                ad=False
                break
    if ad:
        ans+=1
print(ans)


### FIXED CODE ###

from collections import Counter
n=int(input())
*a,=map(int, input().split())
sa=Counter(a)

if 1 in sa:
    if sa[1]>1:
        print(0)
    else:
        print(1)
    exit()

# def fct(x):
#     f1=[1]
#     f2=[]
#     for i in range(2,min(int(x**(1/2)+7),x)):
#         if x%i==0:
#             f1.append(i)
#             f2.append(x//i)
#     return (set(f1+f2))
ans=0
for ai in sa:
    if sa[ai]>1:
        continue
    
    ans+=1
    if ai%2==0:
        for i in range(2,min(int(ai**(1/2)+7),ai)):
            if ai%i==0:
                if i in sa or ai//i in sa:
                    ans-=1
                    break
    else:
        for i in range(3,min(int(ai**(1/2)+7),ai),2):
            if ai%i==0:
                if i in sa or ai//i in sa:
                    ans-=1
                    break
print(ans)
### BUGGY CODE ###

n = int(input())
ss = []
sum = 0
for i in range(n):
    s = input()
    if s not in ss:
        sum +=1
        ss.append(s)

print(sum)


### FIXED CODE ###

n = int(input())
ss = set([])
for i in range(n):
    s = input()
    ss.add(s)

print(len(ss))
### BUGGY CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))
for i in range(N-K):
    be = A[i:i+K]
    af = A[i+1:i+K+1]
    b = 1
    a = 1
    for i in be:
        b *= i
    for i in af:
        a *= i
    if b < a :
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

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

result = []
for i in range(K, N):
    if A[i] > A[i - K]:
        result.append('Yes')
    else:
        result.append('No')
print(*result, sep='\n')
### BUGGY CODE ###

import bisect
from collections import deque

n = int(input())
A = []
count = 0
for _ in range(n):
    a = int(input())
    if len(A) == 0:
        A.append(a)
        count += 1
        continue
    i = bisect.bisect_left(A, a)
    if i == 0:
        dq_A = deque(A)
        dq_A.appendleft(a)
        A = list(dq_A)
        count += 1
    else:
        A[i-1] = a

ans = count
print(ans)

### FIXED CODE ###

import bisect
from collections import deque

n = int(input())
A = []
dq_A = deque(A)
count = 0
for _ in range(n):
    a = int(input())
    if len(dq_A) == 0:
        dq_A.appendleft(a)
        count += 1
        continue
    i = bisect.bisect_left(dq_A, a)
    if i == 0:
        dq_A.appendleft(a)
        count += 1
    else:
        dq_A[i-1] = a

ans = count
print(ans)
### BUGGY CODE ###

def iin(): return int(input())
def nl(): return list(map(int, input().split()))
def ary(r, c, v): return [[v for _ in range(c)] for _ in range(r)]

N, C = nl()
d = [nl() for _ in range(C)]
c = [nl() for _ in range(N)]

ans = float('inf')
for c0 in range(1, C + 1):
    for c1 in range(1, C + 1):
        if c0 == c1:
            continue
        for c2 in range(1, C + 1):
            if c0 == c2 or c1 == c2:
                continue
            cost = 0
            for i in range(N):
                for j in range(N):
                    next_color = [c0, c1, c2][(i + j) % 3]
                    cost += d[c[i][j] - 1][next_color - 1]
            ans = min(ans, cost)
print(ans)

### FIXED CODE ###

n, c = map(int, input().split())
arrD = list(list(map(int, input().split())) for i in range(c))
arrC = list(list(map(int, input().split())) for i in range(n))

##剰余r=0,1,2で、
    ##色の出現数を確認する -> いずれかの色に統一する
        ##どの色に統一するか全パターンを実施して、違和感を算出
##和を取る

arrCCnt = []
for r in range(3):
    d = dict()
    for i in range(1, c + 1):
        d[i] = 0
    arrCCnt += [d]

ret = 1000 * 500 * 500
for r in range(3):
    for i in range(1, n + 1):
        for j in range(1, n + 1):
            if (i + j) % 3 == r:
                arrCCnt[r][arrC[i - 1][j - 1]] += 1##色の出現数を確認

##print(arrCCnt)
for c0 in range(1, c + 1):
    for c1 in range(1, c + 1):
        for c2 in range(1, c + 1):
            if c0 != c1 and c1 != c2 and c2 != c0:
                buf = 0
                ##print(c0,c1,c2)
                for i0 in range(1, c + 1):
                    ##print(i0)
                    buf += arrD[i0 - 1][c0 - 1] * arrCCnt[0][i0]##数
                for i1 in range(1, c + 1):
                    buf += arrD[i1 - 1][c1 - 1] * arrCCnt[1][i1]##数
                for i2 in range(1, c + 1):
                    buf += arrD[i2 - 1][c2 - 1] * arrCCnt[2][i2]##数
                ret = min(ret, buf)
print(ret)