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

N = input()
list = [int(a) for a in input().split()]
count = 0
stack = []
for i in list:
    if stack.count(i) == 0:
        if i > list.count(i):
            count += list.count(i)
        else:
            count += list.count(i) - i
        stack.append(i)                           
print(count)

### FIXED CODE ###

N = int(input())
list = [int(a) for a in input().split()]
dict = dict()
for i in range(N):
    if list[i] in dict:
        dict[list[i]] += 1
    else:
        dict[list[i]] = 1
count = 0
for i, j in dict.items():
#    print(i, j) 
    if i <= j:
        count += j - i
    else:
        count += j
              
print(count)
### BUGGY CODE ###

N = int(input())
A = list(map(str, input().split()))
Q = int(input())
B = [0]*Q
C = [0]*Q
s = sum(list(map(int,A)))
for i in range(Q):
    B[i], C[i] = map(str, input().split())

for i in range(Q):
    if B[i] in A:        
        string = ",".join(A)
        string_new = string.replace(B[i],C[i])
        A =  string_new.split(",")
        s = sum(list(map(int,A)))
    
    print(s)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
S = []
c = 0
s = sum(A)
table = [0] * 100010
# A = pd.Series(A)
# for a in A:
#     print(a)

for i in A:
    table[i] += 1

for i in range(Q):
    B, C = map(int,input().split())
    # if B in A:
    # c = A.count(B)
    c = table[B]
    s += (C - B) * c
    table[C] += table[B]
    table[B] = 0
    # print(s)
        # print((C - B) * c) 
        # string = ",".join(A)
        # string_new = string.replace(B,C)
        # A =  string_new.split(",")
        # s = sum(map((lambda x: int(x)), A))
    S.append(s)

        # A.replace(B, C,c)
        # while B in A:
        #     A[A.index(B)] = C
    # for a in A:
    #     print(a)
    # else:
        # S.append(s)



for s in S:
    print(s)
### BUGGY CODE ###

import heapq
n,m = map(int, input().split())

a = list(map(int, input().split()))
heapq.heapify(a)

for i in range(m):
  b,c = map(int, input().split())
  for j in range(b):
    if a[0] < c:
      heapq.heappop(a)
      heapq.heappush(a, c)

print(sum(a))

### FIXED CODE ###

import heapq
n,m = map(int, input().split())

a = list(map(int, input().split()))
heapq.heapify(a)

min_num = a[0]

tmp_array = []

for i in range(m):
  b,c = map(int, input().split())
  tmp_array.append([b,c])

sort_array = sorted(tmp_array, key=lambda x: -x[1])

for i in range(m):
  b = sort_array[i][0]
  c = sort_array[i][1]
  if min_num >= c:
    continue
  else:
    for j in range(b):
      if a[0] < c:
        heapq.heappop(a)
        heapq.heappush(a, c)
      else:
        break
    min_num = a[0]

#for i in range(m):
#  b,c = map(int, input().split())
#  if min_num >= c:
#    continue
#  else:
#    for j in range(b):
#      if a[0] < c:
#        heapq.heappop(a)
#        heapq.heappush(a, c)
#      else:
#        break
#    min_num = a[0]

print(sum(a))
### BUGGY CODE ###

# coding: utf-8
N = int(input())
_A = sorted(enumerate(map(int, input().split()), 1), key=lambda x:x[1], reverse=True)
dp = [[0 for _ in range(N+1)] for i in range(N+1)]

for i in range(1,N+1):
    k, Ak = _A[i-1]
    if (N-i-k) < 0:break
    dp[0][i] = dp[0][i-1] + (N-i+1-k) * Ak

for i in range(1,N+1):
    k, Ak = _A[i-1]
    if (k-i) < 0:break
    dp[i][0] = dp[i-1][0] + (k-i) * Ak

for x in range(1, N+1):
    for y in range(1, N-x+1):
        k, val = _A[x+y-1]
        dp[x][y]= max((k-x >= 0)*(dp[x-1][y] + (k-x)*val),
                     (N-y-k+1 >= 0)*(dp[x][y-1] + (N-y-k+1) * val))

print(int(max(dp[i][N-i] for i in range(N+1))))


### FIXED CODE ###

# coding: utf-8
N = int(input())
_A = sorted(enumerate(map(int, input().split()), 1), key=lambda x:x[1], reverse=True)
dp = [[0] * (N+1) for i in range(N+1)]

for i in range(1,N+1):
    k, Ak = _A[i-1]
    if (N-i-k) < 0:break
    dp[0][i] = dp[0][i-1] + (N-i+1-k) * Ak

for i in range(1,N+1):
    k, Ak = _A[i-1]
    if (k-i) < 0:break
    dp[i][0] = dp[i-1][0] + (k-i) * Ak

for x in range(1, N+1):
    for y in range(1, N-x+1):
        k, val = _A[x+y-1]
        dp[x][y]= max(dp[x-1][y] + abs(k-x)*val,
                      dp[x][y-1] + abs(N-y-k+1) * val)

print(int(max(dp[i][N-i] for i in range(N+1))))
### BUGGY CODE ###

R,G,B,N = map(int, input().split())
cnt = 0
for r in range((N+R)//R):
	for g in range((N+G)//G):
		b = (N-(R*r+G*g))/B
		if b >= 0 and b%1==0:
			cnt += 1
print(cnt)

### FIXED CODE ###

def solve():
    R,G,B,N=map(int,input().split())
    ans=0
    for i in range(N+1):
        for j in range(N+1):
            tmp=N-R*i-G*j
            if tmp>=0 and tmp%B==0:
                ans+=1
    print(ans)

solve()
### BUGGY CODE ###

n = int(input())
power = 1
for i in range(1, n+1):
    power *= i

ans = power % 1000000007
print(ans)

### FIXED CODE ###

n = int(input())
power = 1
for i in range(1, n+1):
    power *= i
    power %= 1000000007

print(power)
### BUGGY CODE ###

import copy
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
  
def main():
  n = int(input())
  arr = list(map(int, input().split()))
  prime = primes(10**6)
  pf = isPair(prime, arr)
  sf = isSet(prime, arr)
  

  if pf and sf:
    print('pairwise coprime')
    exit()
  if not sf:
    print('not coprime')
    exit()
  else:
    print('setwise coprime')
    exit()

def isPair(prime, arr):
  searched = []
  for p in prime:
    for a in arr:
      if a % p == 0:
        if p in searched:
          return False
        searched += [p]
  return True

def isSet(prime, arr):
  searched = []
  for p in prime:
    if arr[0] % p == 0:
      searched.append(p)
      
  for a in arr[1:]:
    if len(searched) == 0:
      return True
    tmp = []
    for s in searched:
      if a % s == 0:
        tmp.append(s)
        
    searched = tmp
  if len(searched) == 0:
      return True
  return False
  
  
main()

### FIXED CODE ###

import math
from functools import reduce

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

def factorize(n, d):
  # if n == 0 or n == 1:
    # return []
    arr = []
    tmp = n
    while True:
      i = d[tmp]
      if i == 1:
        break
      #cnt=0
      while tmp%i==0:
        #cnt+=1
        tmp //= i
      arr.append(i)
    if tmp!=1:
      arr.append(tmp)
    if arr==[]:
      arr.append(n)
    return arr

def minimum_prime(n):
  # 試し割りをする際の最小の素数
  # エラトステネスの篩と同様の実装
    d = list(range(n+1))
    d[0] = 1
    for i in range(2, int(n**0.5) + 1):
        if d[i] != i:
          continue
        for j in range(i * 2, n + 1, i):
          if d[j] == j:
            d[j] = i
    return d  

def main():
  n = int(input())
  arr = list(map(int, input().split()))
  max_arr = max(arr)
  d = minimum_prime(max_arr)
  dp = [0]*(max_arr+1)
  
  if gcd(*arr) != 1:
    print('not coprime')
    exit()
  
  searched = []
  for a in arr:
    if a != 1:
      primes = factorize(a, d)
      for p in primes:
        dp[p] += 1

  if max(dp) < 2:
    print('pairwise coprime')
  else:
    print('setwise coprime')
    

main()
### BUGGY CODE ###

from collections import deque

H, W = [int(i) for i in input().split()]
A = [[i for i in input()] for j in range(H)]

q = deque()
for h in range(H):
    for w in range(W):
        if A[h][w] == '#':
            q.append((h, w))

dh = [1, -1, 0, 0]
dw = [0, 0, 1, -1]
ans = 0

while len(q):
    ans += 1
    n = len(q)
    for i in range(n):
        h, w = q.pop()
        for j in range(4):
            nh = h + dh[j]
            nw = w + dw[j]
            if nh >= H or nh < 0 or nw >= W or nw < 0:
                continue
            if A[nh][nw] == '.':
                A[nh][nw] = '#'
                q.append((nh, nw))

print(ans - 1)

### FIXED CODE ###

from collections import deque

H, W = [int(i) for i in input().split()]
A = [[i for i in input()] for j in range(H)]

q = deque()
for h in range(H):
    for w in range(W):
        if A[h][w] == '#':
            q.append((h, w))

dh = [1, -1, 0, 0]
dw = [0, 0, 1, -1]
ans = 0

while len(q):
    ans += 1
    n = len(q)
    for i in range(n):
        h, w = q.popleft()
        for j in range(4):
            nh = h + dh[j]
            nw = w + dw[j]
            if nh >= H or nh < 0 or nw >= W or nw < 0:
                continue
            if A[nh][nw] == '.':
                A[nh][nw] = '#'
                q.append((nh, nw))

print(ans - 1)
### BUGGY CODE ###

import heapq
n,m=map(int,input().split())
c=[list(map(int,input().split())) for i in range(n)]
l=list()
v=0
heapq.heapify(l)
for i in range(1,m+1):
  for j in range(n):
    if c[j][0]==i:
      heapq.heappush(l,(-1)*c[j][1])
  if l:
    v+=heapq.heappop(l)*(-1)
print(v)

### FIXED CODE ###

import heapq
n,m=map(int,input().split())
lis=[[] for i in range(m)]
for i in range(n):
  a,b=map(int,input().split())
  if a-1<m:
    lis[a-1].append(-b)
l=list()
v=0
for i in range(m):
  for j in lis[i]:
    heapq.heappush(l,j)
  if l:
    v+=heapq.heappop(l)*(-1)
print(v)
### BUGGY CODE ###

a,b,c,d=map(int,input().split())
while True:
    c-b
    if c<=0:
        print('Yes')
        break
    a-d
    if a<=0:
        print('No')
        break


### FIXED CODE ###

a,b,c,d=map(int,input().split())
x=(a+d-1)//d
y=(c+b-1)//b
if x>=y:
    print('Yes')
else:
    print('No')
### BUGGY CODE ###

def resolve():
    N = int(input())
    S = input()
    cnt = 0
    for i in range(0, N-3):
        si = S[i]
        for a in retA(si):
            idx1 = S.find(a, i)
            b = retB(a, si)
            while idx1 != -1:
                cnt += S[idx1+1:].count(b)
                if 2*idx1 - i < N:
                    if S[2*idx1 - i] == b:
                        cnt -= 1
                idx1 = S.find(a, idx1+1)

    print(cnt)

def retA(a):
    if a == 'R':
        A = ('G', 'B')
    elif a == 'G':
        A = ('R', 'B')
    elif a == 'B':
        A = ('R', 'G')
    return A

def retB(a, x):
    if (a == 'R' or x == 'R') and (a == 'G' or x == 'G'):
        b = 'B'
    elif (a == 'B' or x == 'B') and (a == 'G' or x == 'G'):
        b = 'R'
    elif (a == 'B' or x == 'B') and (a == 'R' or x == 'R'):
        b = 'G'
    return b

if __name__ == '__main__':
    resolve()

### FIXED CODE ###

def resolve():
    N = int(input())
    S = input()
    rc = S.count('R')
    bc = S.count('B')
    gc = S.count('G')

    cnt = rc * bc * gc

    for i in range(0, N):
        for d in range(0, N):
            j = i + d
            k = j + d
            if N < k+1:
                break
            if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                cnt -= 1
    print(cnt)

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

import sys
input = sys.stdin.readline
N, K = map(int, input().split())
A = list(map(int, input().split()))
F = list(map(int, input().split()))

A.sort()
F.sort(reverse=True)
B = [[A[i], F[i]] for i in range(N)]


for i in range(K):
    B.sort(reverse=True, key=lambda x: x[0]*x[1])
    if B[0][0] > 0:
        B[0][0] -= 1
    else:
        break
B.sort(reverse=True, key=lambda x: x[0]*x[1])
print(B[0][1]*B[0][0])


### FIXED CODE ###

import sys
import bisect
import math
input = sys.stdin.readline
N, K = map(int, input().split())
A = list(map(int, input().split()))
F = list(map(int, input().split()))

A.sort()
F.sort(reverse=True)

B = [(A[i]*F[i], F[i]) for i in range(N)]
B.sort(reverse=True)
L = 0
R = B[0][0]
if sum(A) <= K:
    print(0)
    exit(0)
while(1):
    ans = (L+R) // 2
    flag = True
    tmp = 0
    for i in range(N):
        tmp += math.ceil(max(B[i][0] - ans, 0) / B[i][1])
        if tmp > K:
            flag = False
            break
    if flag:
        R = ans
    else:
        L = ans
    if L == R or L+1 == R:
        print(R)
        break
### BUGGY CODE ###

from bisect import bisect_left,bisect
import sys
 
N=int(sys.stdin.readline())
a=list(map(int,sys.stdin.readline().split()))
b=list(map(int,sys.stdin.readline().split()))
ans=0
for i in range(29):
  a_nex=sorted(list(map(lambda x:x%2**(i+1),a)))
  b_nex=sorted(list(map(lambda x:x%2**(i+1),b)))
  l=0
  p=q=r=0
  for k in reversed(a_nex):
    while p<N and b_nex[p]<2**i-k:
      p+=1
    while q<N and b_nex[q]<2*2**i-k:
      q+=1
    while r<N and b_nex[r]<3*2**i-k:
      r+=1
    l+=q-p+N-r
  ans+=l%2<<i
print(ans)   
  


### FIXED CODE ###

N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
def f(i):
  res=0
  t=2**i
  a_nex=sorted([p%(2*t) for p in a])
  b_nex=sorted([p%(2*t) for p in b])
  l=0
  p=q=r=0
  for k in reversed(a_nex):
    while p<N and k+b_nex[p]<t:
      p+=1
    while q<N and k+b_nex[q]<2*t:
      q+=1
    while r<N and k+b_nex[r]<3*t:
      r+=1
    l+=q-p+N-r
  res=(l%2)<<i
  return res
for k in range(29):
  ans+=f(k)
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
MOD = 10 ** 9 + 7


# 最大公約数
def gcd(a, b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b


# 最小公倍数
def lcm(a, b):
    return a * b // gcd(a, b)


def main():
    n = int(input())
    A = list(map(int, input().split()))
    l = 1
    for a in A:
        l = lcm(l, a)
    ans = 0
    for a in A:
        ans += l * pow(a, MOD - 2, MOD)
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
# INF = float("inf")


# 最大公約数
def gcd(a, b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b


# 最小公倍数
def lcm(a, b):
    return a * b // gcd(a, b)


def main():
    n = int(input())
    A = list(map(int, input().split()))
    l = 1
    for a in A:
        l = lcm(l, a)
    c = 0
    for a in A:
        c += pow(a, MOD - 2, MOD)
    ans = l * c % MOD
    print(ans)


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

S = str(input())
N = len(S)
l = 0
r = 0


follow = 0
amari = [0] * N
for i in range(N):
  Kazu = int(S[N-i-1]) * pow(10, i)
  Amari_ = (int(Kazu) + follow) % 2019
  amari[i] = Amari_
  follow = Amari_

from collections import Counter
c_ = Counter(amari)
c = c_.most_common()

ans = 0
for i in c:
  if i[1] != 0:
    ans += i[1] * (i[1]-1) // 2
  else:
    break

ans += c_[0]
print(ans)

### FIXED CODE ###

S = str(input())
N = len(S)

ans = 0
amari = [0] * 2019
amari[0] = 1
follow = 0
POW = 1

for i in reversed(S):
  follow += int(i) * POW
  follow %= 2019
  amari[follow] += 1
  POW *= 10
  POW %= 2019
  
print(sum( i * (i-1) // 2 for i in amari ))
### BUGGY CODE ###

N = int(input())
ans = 1
t = 10**9+7
for i in range(1,N+1):
    ans *= i
print(ans%t)

### FIXED CODE ###

N = int(input())
ans = 1
t = 10**9+7
for i in range(1,N+1):
    ans = (ans*i)%t
print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**6)
H,W = map(int,input().split())
grid = []
for _ in range(H):
  grid.append(list(input()))

def dfs(i,j,direction):
  if i<0 or j<0 or i>=H or j>=W:
    return 0
  if grid[i][j] == "#":
    return 0

  if direction == "L":
    return 1 + dfs(i,j-1,direction)
  elif direction == "R":
    return 1 + dfs(i,j+1,direction)
  elif direction == "U":
    return 1 + dfs(i+1,j,direction)
  else:
    return 1 + dfs(i-1,j,direction)

res = 0
for i in range(H):
  for j in range(W):
    if grid[i][j] != "#":
      step = 1
      for d in ["L","R","U","D"]:
        ni,nj = i,j
        if d=="L": nj = j-1
        if d=="R": nj = j+1
        if d=="U": ni = i+1
        if d=="D": ni = i-1
        step += dfs(ni,nj,d)
      res = max(res, step)
      if res == H+W-1:
        print(res)
        exit()

print(res)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
H,W = map(int,input().split())
grid = []
for _ in range(H):
  grid.append(list(input()))

L = [ [0]*W for _ in range(H) ]
R = [ [0]*W for _ in range(H) ]
U = [ [0]*W for _ in range(H) ]
D = [ [0]*W for _ in range(H) ]

for i in range(H):
  for j in range(W):
    if j-1 >= 0:
      L[i][j] = L[i][j-1]
    if i-1 >= 0:
      D[i][j] = D[i-1][j]

    if grid[i][j] == ".":
      L[i][j] += 1
      D[i][j] += 1
    else:
      L[i][j] = 0
      D[i][j] = 0

for i in range(H-1,-1,-1):
  for j in range(W-1,-1,-1):
    if j+1 < W:
      R[i][j] = R[i][j+1] 
    if i+1 < H:
      U[i][j] = U[i+1][j]
    if grid[i][j] == ".":
      R[i][j] += 1
      U[i][j] += 1
    else:
      R[i][j] = 0
      U[i][j] = 0

res = 0
for i in range(H):
  for j in range(W):
    if grid[i][j] == ".":
      res = max(res, L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)

print(res)
### BUGGY CODE ###

import collections

N = int(input())
A = list(map(int,input().split()))
Q = int(input())
BC = [list(map(int,input().split())) for _ in range(Q)]

ans = sum(A)

for i in range(Q):
    counter = collections.Counter(A)
    if BC[i][0] in counter:
        ans += counter[BC[i][0]]*(BC[i][1]-BC[i][0])
        print(ans)
        A = [BC[i][1] if x==BC[i][0] else x for x in A]
    else:
        print(ans)

### FIXED CODE ###

import collections

N = int(input())
A = list(map(int,input().split()))
Q = int(input())
BC = [list(map(int,input().split())) for _ in range(Q)]

ans = sum(A)
d = collections.defaultdict(int)

for key in A:
    d[key] += 1

for i in range(Q):
    b,c = BC[i][0],BC[i][1]
    ans += d[b]*(c-b)
    d[c] += d[b]
    d[b] = 0
    print(ans)
### BUGGY CODE ###

N, Q = [int(i) for i in input().split()]
S = input()
L = [0 for i in range(Q)]
R = [0 for i in range(Q)]
for i in range(Q):
    L[i], R[i] = [int(i) for i in input().split()]

for i in range(Q):
    ans = 0
    substr = S[L[i] - 1:R[i]]
    while substr:
        i = substr[:-1].find('A')
        if i < 0:  # not found
            break
        elif substr[i + 1] == 'C':  # found AC
            ans += 1
            substr = substr[i + 2:]
        else:  # found A without C
            substr = substr[i + 1:]
    print(ans)


### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
L, R = [0] * Q, [0] * Q
for q in range(Q):
    L[q], R[q] = map(int, input().split())

t = [0] * (N + 1)
for i in range(N):
    t[i + 1] = t[i] + (1 if S[i:i + 2] == 'AC' else 0)

for q in range(Q):
    l, r = L[q], R[q]
    print(t[r - 1] - t[l - 1])
### BUGGY CODE ###

def main():
  ans = 0
  n = int(input())
  a = tuple(map(int, input().split()))
  a_ = tuple(set(a))
  ov = 10**9+7
  from fractions import gcd
  def lcm(a):
      x = a[0]
      ln = len(a)
      for i in range(1, ln):
          x = (x * a[i]) // gcd(x, a[i])
      return x
  l = lcm(a_)
  for i in a:
    ans += l//i%ov
  print(ans%ov)
if __name__ == "__main__":
  main()

### FIXED CODE ###

def main():
  from functools import reduce
  from fractions import gcd
  ans = 0
  n = int(input())
  b = tuple(map(int, input().split()))
  ov = 10**9+7
  def lcm(x,y):
    return (x * y) // gcd(x, y)
  def lcm_list(a):
    return reduce(lcm, a, 1)
  l = lcm_list(b)
  for i in range(n):
    ans += l//b[i]
  print(ans%ov)
if __name__ == "__main__":
  main()
### BUGGY CODE ###

def main():
    N = int(input())
    As = list(map(int, input().split()))
    c = 0
    for i in range(N):
        l = 0
        r = 0
        for ii in range(i, N):
            if r & As[ii] != 0: break
            l ^= As[ii]
            r += As[ii]
            if l == r: c += 1

    print(c)
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    N = int(input())
    A = list(map(int, input().split()))
    x = 0
    s = 0
    r = 0
    res = 0
    for l in range(N):
        while N > r and x ^ A[r] == s + A[r]:
            x ^= A[r]
            s += A[r]
            r += 1

        x ^= A[l]
        s -= A[l]
        res += r - l

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

n,k,q = list(map(int, input().split()))
win_lst = []
for i in range(q):
  winner = int(input())
  win_lst.append(winner)
#print(win_lst)
    
win_ct_lst = []
for j in range(1, n + 1):
  win_ct_lst.append(win_lst.count(j))
#print(win_ct_lst)

lose_pt_lst = []
for m in range(len(win_ct_lst)):
  lose_pt_lst.append(win_ct_lst[m] - sum(win_ct_lst))

for l in range(len(win_ct_lst)):
  if (k + lose_pt_lst[l] >= 1):
    print("Yes")
  else:
    print("No")


### FIXED CODE ###

n,k,q = list(map(int, input().split()))
win_lst = []
for i in range(q):
  winner = int(input())
  win_lst.append(winner)

ct_lst = [0] * n
for x in win_lst:
  ct_lst[x-1] += 1

ttl = sum(ct_lst)
for y in ct_lst:
  if (k-ttl + y) >= 1:
    print("Yes")
  else:
    print("No")
### BUGGY CODE ###

from collections import Counter

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

for k in range(n):  
    freq = Counter(a)
    freq[a[k]]-=1
    total = 0
  
    for key,val in freq.items():
        if( val>1):
            total+= (val*(val-1))//2
        
    print(total)

### FIXED CODE ###

from collections import Counter

n = int(input())
a = input().split()
freq = Counter(a)
#print(freq)
total=0
    
for key,val in freq.items():
    total+=(val*(val-1))//2

for k in range(n): 

    kth = (freq[a[k]]*(freq[a[k]]-1))//2
    newkth = ((freq[a[k]]-2)*(freq[a[k]]-1))//2  

    total -= kth
    total += newkth
    
    print(total)
    
    total -=newkth
    total +=kth
### BUGGY CODE ###

S = input()
T = input()

con = 0

ans = "Yes"

for i in range(0,len(S)):
  for j in range(i,len(S)):
    if T[i] == T[j]:
      if S[i] != S[j]:
        ans = "No"
        break
      else:
        continue
    if S[i] == S[j]:
      if T[i] != T[j]:
        ans = "No"
        break
      else:continue

print(ans)

### FIXED CODE ###

S = input()
T = input()

ans = "Yes"
 
for i in range(0,len(S)):
  for j in range(0,i):
    if S[j] == S[i]:
      if T[i] != T[j]:
        ans = "No"
        break
      break
    if T[j] == T[i]:
      if S[j] != S[i]:
        ans = "No"
        break
      break
print(ans)
### BUGGY CODE ###

n=int(input())
s=input()
a=[s[:i].count('W')+s[i+1:].count('E') for i in range(n)]
print(min(a))

### FIXED CODE ###

n=int(input())
s=input()
w,e=0,s.count('E')
for i in s:
    if i =='W':
        n=min(n,w+e)
        w+=1
    else:
        e-=1
        n=min(n,w+e)
print(n)
### BUGGY CODE ###

from fractions import gcd

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

l = A[0]
for i in range(1, N):
    l = l * A[i] // gcd(l, A[i])

for a in A:
    res += l//a

print(res % 1000000007)

### FIXED CODE ###

from fractions import gcd

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

l = A[0]
for i in range(1, N):
    l = l * A[i] // gcd(l, A[i])

for a in A:
    res += l//a

print(res % 1000000007)
### BUGGY CODE ###

#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
import math

def factorize(n):
  ret, a = [], n
  for i in range(2, int(n**0.5)+1):
    if a%i>0: continue
    c=0
    while a%i==0:
      a//=i
      c+=1
    else:
      ret.append((i,c))
  if a!=1: ret.append((a,1))
  return ret

#nの素数判定
def is_prime(n):
	if n == 1:
		return False
	for i in range(2,int(n**0.5)+1):
		if n % i == 0: return False
	return True


n = int(input())
N = factorize(n)
#p(N)

i = 2
ans=0
while n >= i:
  if is_prime(n):
    n /= n
    ans += 1
    #p("ans=",ans)
  elif n % i ==0:
    for k,_ in N:
      a = math.log(i, k)
      #p("n,i,k,a,int(a)=",n,i,k,int(a),a)
      if int(a)==a:
        n /= i
        ans += 1
        #p("ans=",ans)

  i += 1

print(ans)


### FIXED CODE ###

#-------------------------------------------------------------------
import sys
def _p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
import math

def factorize(n):
  ret, a = [], n
  for i in range(2, int(n**0.5)+1):
    if a%i>0: continue
    c=0
    while a%i==0:
      a//=i
      c+=1
    else:
      ret.append((i,c))
  if a!=1: ret.append((a,1))
  return ret


n = int(input())
N = factorize(n)

ans=0
for p,i in N:
  for j in range(i):
    a = pow(p,j+1)
    if n % a == 0:
      n /= a
      ans += 1

print(ans)