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

from fractions import gcd
mod = 10**9+7
n = int(input())
a = list(map(int,input().split()))
ans = 0
l = 1
for i in range(n):
    l = l*a[i]//gcd(l,a[i])
for i in a:
    ans = (ans + l*pow(i,mod-2,mod)) % mod
print(ans)

### FIXED CODE ###

from fractions import gcd
mod = 10**9+7
n = int(input())
a = list(map(int,input().split()))
ans = 0
l = 1
for i in a:
    l = l*i//gcd(l,i)
l %= mod
for i in a:
    ans = (ans +l*pow(i,mod-2,mod)) % mod
print(ans)
### BUGGY CODE ###

n = int(input())
a_lst = []
for i in range(n):
    a = int(input())
    a_lst.append(a)

max_a = max(a_lst)
max_a_id_lst = [i for i, elem in enumerate(a_lst) if elem == max_a]

for i in range(n):
    if i in max_a_id_lst:
        if len(max_a_id_lst) == 1:
            a_lst.remove(max_a)
            print(max(a_lst))
        else:
            print(max_a)
    else:
        print(max_a)

### FIXED CODE ###

n = int(input())
a_lst = []
for i in range(n):
    a = int(input())
    a_lst.append(a)

sorted_a_lst = sorted(a_lst)
max_a = sorted_a_lst[-1]

for a in a_lst:
    if a == max_a:
        print(sorted_a_lst[-2])
    else:
        print(max_a)
### BUGGY CODE ###

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

dp = [[0 for i in range(W+1)] for j in range(N+1)]

for i in range(N):
    for sum_w in range(W+1):
        if sum_w >= li[i][0]:
            dp[i+1][sum_w] = max(dp[i][sum_w-li[i][0]]+li[i][1],dp[i][sum_w])
        else:
            dp[i+1][sum_w] = dp[i][sum_w]

print(dp[N][W])


### FIXED CODE ###

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

dp = [[0 for i in range(W+1)] for j in range(N+1)]

for i in range(N):
    for sum_w in range(W+1):
        if sum_w >= li[i][0]:
            dp[i+1][sum_w] = max(dp[i][sum_w-li[i][0]]+li[i][1],dp[i][sum_w])
        else:
            dp[i+1][sum_w] = dp[i][sum_w]

print(dp[N][W])
### BUGGY CODE ###

A,B,K = map(int,input().split())
for i in range(A,B+1):
    if(i < A+K or i > B-K):
        print(i)

### FIXED CODE ###

A,B,K = map(int,input().split())
if(B-A > 1000):
    for i in range(A,A+K):
        print(i)
    for i in range(B+1-K,B+1):
        print(i)
else:
    for i in range(A,B+1):
        if(i < A+K or i > B-K):
            print(i)
### BUGGY CODE ###

n = int(input())
s = [input() for i in range(n)]
s,ans = s+s,0
for i in range(n):
	flag = True
	for j in range(i,i+n):
		x = ""
		for k in range(i+1,i+n): x+=s[k][j-i]
		if s[j][1:n]!=x:
			flag = False
			break
	if flag: ans += n
print(ans)

### FIXED CODE ###

n = int(input())
s = [input() for i in range(n)]
s,s2,ans = s+s,[],0
for i in range(n):
	x = ""
	for j in s: x+=j[i]
	s2.append(x)
for i in range(n):
	flag = True
	for j in range(i,i+n):
		if s[j][1:n]!=s2[j-i][1+i:n+i]:
			flag = False
			break
	if flag: ans += n
print(ans)
### BUGGY CODE ###

# D - Banned K

import sys

sys.setrecursionlimit(10 ** 9)

N = int(input())
A = [int(a) for a in input().split()]

def f(i, ls, chosen):
    n1 = len(ls)
    n2 = len(chosen)
    if n1 <= i or n2 == 2:
        if n2 == 2 and chosen[0] == chosen[1]:
            return 1
        return 0
    return f(i + 1, ls, chosen) + f(i + 1, ls, chosen + [ls[i]])

for i in range(N):
    print(f(0, A[:i] + A[i + 1:], []))


### FIXED CODE ###

N = int(input())
A = [int(a) for a in input().split()]
cnt = {}
total = 0

for a in A:
    if a not in cnt:
        cnt[a] = 0
    cnt[a] += 1

for i in cnt.values():
    total += i * (i - 1) // 2

for a in A:
    print(total - (cnt[a] - 1))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
"""
D - Handstand
https://atcoder.jp/contests/abc124/tasks/abc124_d
WA
"""
import sys


from itertools import groupby
from collections import deque

def solve(N, K, S):
    seq = [[k, len(list(g))]  for k, g in groupby(S)]
    if len(seq) <= 2*K:
        return len(S)
    if seq[0][0] == '0':
        seq = [['1', 0]] + seq
    if len(seq) % 2 == 0:
        seq.append(['1', 0])

    seq = deque(seq)
    rem = deque()
    ans = 0
    for i in range(2*K+1):
        _, v = seq.popleft()
        ans += v
        rem.append(v)

    max_ans = ans
    while seq:
        try:
            ans -= rem.popleft()
            _, v = seq.popleft()
            ans += v
            ans -= rem.popleft()
            _, v = seq.popleft()
            ans += v
            max_ans = max(max_ans, ans)
        except:
            max_ans = max(max_ans, ans)
    return max_ans


def main(args):
    N, K = map(int, input().split())
    S = input()
    ans = solve(N, K, S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
D - Handstand
https://atcoder.jp/contests/abc124/tasks/abc124_d
WA
"""
import sys


from itertools import groupby
from collections import deque

def solve(N, K, S):
    seq = [[k, len(list(g))]  for k, g in groupby(S)]
    if len(seq) <= 2*K:
        return len(S)
    if seq[0][0] == '0':
        seq = [['1', 0]] + seq
    if len(seq) % 2 == 0:
        seq.append(['1', 0])

    seq = deque(seq)
    rem = deque()
    ans = 0
    for i in range(2*K+1):
        _, v = seq.popleft()
        ans += v
        rem.append(v)

    max_ans = ans
    while seq:
        _, v = seq.popleft()
        ans += v
        rem.append(v)
        ans -= rem.popleft()
        _, v = seq.popleft()
        ans += v
        rem.append(v)
        ans -= rem.popleft()
        max_ans = max(max_ans, ans)
    return max_ans


def main(args):
    N, K = map(int, input().split())
    S = input()
    ans = solve(N, K, S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
### BUGGY CODE ###

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

m=li[0]
for i in range(1,N):
  m=m*li[i]
if m>10**18:
  print(-1)
else:
  print(m)
    
  

### FIXED CODE ###

N=int(input())
li=list(map(int,input().split()))
 
m=li[0]
if 0 in li:
  m=0
else:
  for i in range(1,N):
    m=m*li[i]
    if m>10**18:
      m=-1
      break
print(m)
### BUGGY CODE ###

import sys
import copy
from collections import deque

sys.setrecursionlimit(10**6)
input = sys.stdin.readline
#read = sys.stdin.buffer.read

def main():
    global field
    R, C, K = map(int, input().split())
    field = []
    for _ in range(R):
        tmp = [0] * C
        field.append(tmp)
    DP0 = copy.deepcopy(field)
    DP1 = copy.deepcopy(field)
    DP2 = copy.deepcopy(field)
    DP3 = copy.deepcopy(field)

    for _ in range(K):
        r, c, k = map(int, input().split())
        field[r-1][c-1] = k
    
    i = 0
    DP1[0][0] = field[0][0]
    for j in range(1, C):
        DP3[i][j] = max(DP2[i][j-1] + field[i][j], DP3[i][j-1])
        DP2[i][j] = max(DP1[i][j-1] + field[i][j], DP2[i][j-1])
        DP1[i][j] = max(DP0[i][j-1] + field[i][j], DP1[i][j-1])
        DP0[i][j] = DP0[i][j-1]

    for i in range(1, R):
        for j in range(C):
            DP3[i][j] = max(DP2[i][j-1] + field[i][j], DP3[i][j-1])
            DP2[i][j] = max(DP1[i][j-1] + field[i][j], DP2[i][j-1])
            DP1[i][j] = max(DP0[i][j-1] + field[i][j], DP1[i][j-1], max(DP0[i-1][j], DP1[i-1][j], DP2[i-1][j], DP3[i-1][j]) + field[i][j])
            DP0[i][j] = max(DP0[i][j-1], DP0[i-1][j], DP1[i-1][j], DP2[i-1][j], DP3[i-1][j])

    ans = max(DP3[R-1][C-1], DP2[R-1][C-1], DP1[R-1][C-1], DP0[R-1][C-1])
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
import copy
from collections import deque

sys.setrecursionlimit(10**6)
input = sys.stdin.readline
#read = sys.stdin.buffer.read

def main():
    global field
    R, C, K = map(int, input().split())
    field = []
    for _ in range(R):
        tmp = [0] * C
        field.append(tmp)
    DP1 = copy.deepcopy(field)
    DP2 = copy.deepcopy(field)
    DP3 = copy.deepcopy(field)

    for _ in range(K):
        r, c, k = map(int, input().split())
        field[r-1][c-1] = k
    
    i = 0
    DP1[0][0] = field[0][0]
    for j in range(1, C):
        DP3[i][j] = max(DP2[i][j-1] + field[i][j], DP3[i][j-1])
        DP2[i][j] = max(DP1[i][j-1] + field[i][j], DP2[i][j-1])
        DP1[i][j] = max(field[i][j], DP1[i][j-1])

    for i in range(1, R):
        for j in range(C):
            DP3[i][j] = max(DP2[i][j-1] + field[i][j], DP3[i][j-1])
            DP2[i][j] = max(DP1[i][j-1] + field[i][j], DP2[i][j-1])
            DP1[i][j] = max(field[i][j], DP1[i][j-1], max(DP1[i-1][j], DP2[i-1][j], DP3[i-1][j]) + field[i][j])

    ans = max(DP3[R-1][C-1], DP2[R-1][C-1], DP1[R-1][C-1])
    print(ans)


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

x = int(input())

if x >= 2000:
    print(1)
else:
    flag = False
    n = 19
    for a in range(n):
        for b in range(n):
            for c in range(n):
                for d in range(n):
                    for e in range(n):
                        for f in range(n):
                            if x == a * 100 + b * 101 + c * 102 + d * 103 + e * 104 + f * 105:
                                flag = True
                                break
                        if flag:
                            break
                    if flag:
                        break
                if flag:
                    break
            if flag:
                break
        if flag:
            break

    print(1) if flag else print(0)


### FIXED CODE ###

x = int(input())

dp = [0] * 100001

dp[100] = dp[101] = dp[102] = dp[103] = dp[104] = dp[105] = 1

for i in range(106, 100001):
    if dp[i - 100] == 1 or dp[i - 101] == 1 or dp[i - 102] == 1 or dp[i - 103] == 1 or dp[i - 104] == 1 or dp[
        i - 105] == 1:
        dp[i] = 1

print(dp[x])
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
prod_sum = 0
for i in range(n-1):
    for j in range(i+1, n):
        prod_sum += a[i]*a[j]
print(prod_sum%(10**9+7))


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
prod_sum = 0
sum_arr = [0]*n
sum_arr[n-1] = a[n-1]
for i in range(n-2, -1, -1):
    sum_arr[i] = sum_arr[i+1] + a[i]
for i in range(n-1):
        prod_sum += a[i]*sum_arr[i+1]
print(prod_sum%(10**9+7))
### BUGGY CODE ###

A, B, C, D = map(int, input().split())
turn = 0
while (turn := turn + 1) and ((C := C - B) if turn & 1 else (A := A - D)): pass
print("Yes" if turn & 1 else "No")


### FIXED CODE ###

A, B, C, D = map(int, input().split())
turn = 0
while (turn := turn + 1) and ((C := C - B) if turn & 1 else (A := A - D)) > 0: pass
print("Yes" if turn & 1 else "No")
### BUGGY CODE ###

import sys
from fractions import gcd
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))


mod = 10 ** 9 + 7

l = 1
for i in A:
    l = (l * i) // gcd(l,i)
    
ans = 0
for i in range(N):
    ans += l // A[i]
    ans %= mod
    
print(ans)

### FIXED CODE ###

import sys
from fractions import gcd
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))


mod = 10 ** 9 + 7

l = 1
ans = 0
for i in A:
    l = (l * i) // gcd(l,i)
    ans += pow(i, mod-2, mod)
    ans %= mod
l %= mod
ans = (l * ans) % mod

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

#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
import sys
sys.setrecursionlimit(10 ** 6)

n = int(input())
x = input()
z = '1' * n
o = '0' * n

if (z == x):
  u = n - 1
  d = n - 1
elif (z == o):
  u = 1
  d = 1
else:
  tmp = len(list(filter(lambda x: x == '1', x)))
  u = tmp + 1
  d = tmp - 1


def popcount(i):
  return i % len(list(filter(lambda x: x == '1', format(i, 'b'))))


def toggle(i):
  if (i == '1'):
    return '0'
  else:
    return '1'


def solve(i, count):
  if (i <= 2 * 10**5 + 1 and ans[i] != 0):
    return count + ans[i]
  elif (i == 0):
    return count
  else:
    return solve(popcount(i), count + 1)


ans = [0] * (2 * 10 ** 5 + 1)
for i in range(1, 2 * 10 ** 5):
  ans[i] = solve(i, 0)
for i in range(n):
  if(i == 0):
    _x = toggle(x[0]) + x[1: n]
  elif (i == n - 1):
    _x = x[:i] + toggle(x[n - 1])
  else:
    _x = x[:i] + toggle(x[i]) + x[i + 1:n]
  print(solve(int(_x, 2), 0))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)

n = int(input())
x = input()
z = '1' * n
o = '0' * n
X = int(x, 2)

if (n == 1 and x == '1'):
  print(0)
  exit()

if (z == x):
  u = n - 1
  d = n - 1
elif (o == x):
  u = 1
  d = 1
else:
  tmp = len(list(filter(lambda x: x == '1', x)))
  u = tmp + 1
  d = tmp - 1


def popcount(i):
  return i % len(list(filter(lambda x: x == '1', format(i, 'b'))))


def solve(i, count):
  if (i <= 2 * 10**5 and ans[i] != 0):
    return count + ans[i]
  elif (i == 0):
    return count
  else:
    return solve(popcount(i), count + 1)


def solve2(i, div):
  if (i <= 2 * 10**5):
    return ans[i]
  else:
    return ans[i % div] + 1


ans = [0] * (2 * 10 ** 5 + 4)
_u = (2 * 10 ** 5) // u
U = X % u + (u * _u) + u
if(d != 0):
  _d = (2 * 10 ** 5) // d
  D = X % d + (d * _d) * 2 + d * 2
Us = [0] * (2 * 10 ** 5)
Ds = [0] * (2 * 10 ** 5)
for i in range(1, 2 * 10 ** 5 + 4):
  ans[i] = solve(i, 0)
Us[0] = 1 % u
if(d != 0):
  Ds[0] = 1 % d
for i in range(1, 2 * 10 ** 5):
  Us[i] = (Us[i - 1] * 2) % u
  if(d != 0):
    Ds[i] = (Ds[i-1] * 2) % d

for i in range(n):
  if(x[i] == '0'):
    print(solve2(U + Us[n-i-1], u))
  else:
    if (d == 0):
      print(0)
    else:
      print(solve2(D - Ds[n-i-1], d))
### BUGGY CODE ###

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

from collections import defaultdict
dp = defaultdict(lambda : -1)

def dfs(tpl):
    if dp[tpl] != -1:
        return dp[tpl]
    if len(tpl) == 0:
        return 0
    if len(tpl) == 1:
        dp[tpl] = tpl[0]
        return tpl[0]

    lst_candidates = []
    now_cost = []
    for i in range(len(tpl)-1):
        # print("i: ", i )
        lst_candidates.append (   tpl[0:i] + ( tpl[i]+tpl[i+1], )  + tpl[i+2: ]   )
        now_cost.append ( tpl[i] + tpl[i+1] ) 

    total_cost = []
    for i in range(len(now_cost)):
        total_cost.append ( now_cost [i] + dfs(lst_candidates[i]))

    # print("totla_cost: ", total_cost)
    # print("lst_candidates: ", lst_candidates)
    res = min(total_cost)
    dp[tpl] = res

    return res

print(dfs(A) - sum(A))


### FIXED CODE ###

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

from itertools import accumulate
Accum = list(accumulate([0] + A))

dp = [ [inf]*(N+1) for _ in range(N+1)]

def dfs(l,r):
    if dp[l][r] != inf:
        return dp[l][r]
    if l == r: 
        return 0
    if l+1 == r: 
        dp[l][r] = A[l]
        return A[l]

    local_ans = inf
    for i in range(l+1, r): # 0 to 4, 0-1, 1-4
        local_ans = min(local_ans, dfs(l,i) + dfs(i,r))
    dp[l][r] = local_ans + Accum[r] - Accum[l]
    return dp[l][r]
print (dfs(0,N)- sum(A))
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split())) 
lim = 10**18
ans = 1
for i in A:
    ans *= i
if ans > lim:
        print("-1")
else:
    print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split())) 
lim = 10**18
ans = 1
if 0 in A:
    print(0)
    quit()
for i in A:
    ans *= i
    if ans > lim:
        print("-1")
        quit()

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()))
ans = []
for i in range(x):
    for j in range(y):
        for l in range(z):
            ans.append(a[i] + b[j] + c[l])
ans.sort(reverse=True)
for i in range(k):
    print(ans[i])

### FIXED 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()))
ans = []
for i in range(x):
    for j in range(y):
        ans.append(a[i]+b[j])
ans.sort(reverse=True)
ans = ans[:k]
ans2 = []
for i in range(len(ans)):
    for j in range(z):
        ans2.append(ans[i]+c[j])
ans2.sort(reverse=True)
for i in range(k):
    print(ans2[i])
### BUGGY CODE ###

from itertools import combinations_with_replacement
import bisect

k, s = map(int, input().split())

ans = 0
# for v in combinations_with_replacement(range(k + 1), 3):
#     if sum(v) == s:
#         leng = len(set(v))
#         if leng == 1 or leng == 3:
#             ans += 1
#         else:
#             ans += 3

if k * 3 == s:
    print(1)
    exit(0)
else:
    for v in range(k + 1):
        for x in range(k + 1):
            if v + x > s:
                continue
            else:
                targ = s - v - x
                hoge = bisect.bisect_left([i for i in range(k + 1)], targ)
                if hoge < 0 or hoge > k:
                    pass
                else:
                    ans += 1

            # leng = len(set([v, x, hoge]))
            # if leng == 1 or leng == 3:
            #     ans += 1
            # else:
            #     ans += 3

print(ans)




### FIXED CODE ###

# import bisect

k, s = map(int, input().split())

ans = 0

if k * 3 == s:
    print(1)
    exit(0)
else:
    for v in range(k + 1):
        # bisect.bisect_left([i for i in range(2 * k + 1)], s - v)
        for x in range(k + 1):
            if v + x > s:
                continue
            else:
                targ = s - v - x
                # hoge = bisect.bisect_left([i for i in range(k + 1)], targ)
                if targ < 0 or targ > k:
                    pass
                else:
                    ans += 1

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

import math
import collections
N = int(input())
A = list(map(int, input().split()))
ans = 0
# print(A)
sumA = [sum(A[:i+1]) for i in range(N)]
# print(sumA)
countSum = collections.Counter(sumA)
# print(countSum)
for k,v in countSum.items():
    if k == 0:
        ans += math.factorial(v)
        continue
    if v == 1:
        continue
    # print(k)
    # print(v)
    # print(math.factorial(v-1))
    ans += math.factorial(v-1)
print(ans)

### FIXED CODE ###

from collections import Counter
import numpy as np

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

cumulative_sum = np.cumsum(A)
counts = Counter(cumulative_sum)
ans = 0
for v in counts.values():
    ans += v * (v-1) // 2
    
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)

N,M = map(int,input().split())
L = []
for i in range(N):
  tmp = list(map(int,input().split()))
  L.append(tmp[1:])

dicL = {}
for i in range(N):
  for l in L[i]:
    if l not in dicL:
      dicL[l] = [i]
    else:
      dicL[l].append(i)
#print(dicL)
E = [set() for _ in range(N)]
for k,v in dicL.items():
  if len(v) > 1:
    for i in range(len(v)-1):
      for j in range(i+1,len(v)):
        E[v[i]].add(v[j])
        E[v[j]].add(v[i])
#print(E)
Visited = [0 for _ in range(N)]
def dfs(v):
  Visited[v] = 1
  for u in E[v]:
    if Visited[u] == 0:
      dfs(u)
dfs(0)
print('YES' if sum(Visited) == N else 'NO')
    

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)

N,M = map(int,input().split())
L = []
for i in range(N):
  tmp = list(map(int,input().split()))
  L.append(tmp[1:])
#print(L)

# 人(0~N-1)と言語(N~M-1)の間で二部グラフを作る
E = [set() for _ in range(N+M)]
for i in range(N):
  for l in L[i]:
    E[i].add(l+N-1)
    E[l+N-1].add(i)
#print(E)

# 人のノードすべてに到達可能であればYES
Visited = [0 for _ in range(N+M)]
def dfs(v):
  Visited[v] = 1
  for u in E[v]:
    if Visited[u] == 0:
      dfs(u)
dfs(0)
print('YES' if sum(Visited[:N]) == N else 'NO')
### BUGGY CODE ###

S = list(input())
Q = int(input())
x = 1
l=[]
for i in range(Q):
    l=[]
    l = list(input().split())
    if l[0] == "1":
        x *= -1
    elif l[0] == "2":
        if (l[1] == "2" and x == -1) or  (l[1] == "1" and x == 1):
            S.insert(0, l[2])
        else:
            S.append(l[2])
if x == -1:
    S = S[::-1]
print(*S, sep="")

### FIXED CODE ###

from collections import deque
S = deque(input())
Q = int(input())
x = 1
l=[]
for i in range(Q):
    a, *b = input().split()
    if a == "1":
        x *= -1
    elif a == "2":
        c, d = b
        if (c == "2" and x == -1) or  (c == "1" and x == 1):
            S.appendleft(d)
        else:
            S.append(d)
if x == -1:
    S.reverse()
print(*S, sep="")
### BUGGY CODE ###

N,K = list(map(int,input().split(" ")))
A = list(map(int,input().split(" ")))
num = list(set(A))
#print(num)
ans=[]
for n in num:
    #print(n,"=",A.count(n))
    ans.append(A.count(n))
#print(ans)
#print(len(ans),"種類")
ans.sort()
total=0
for i in range(len(ans)-K):
    total+=ans[i]
print(total)

### FIXED CODE ###

N,K = list(map(int,input().split(" ")))
d={}
for i in input().split(" "):
    if i in d:
        d[i]+=1
    else:
        d[i]=1
print(sum(sorted(d.values())[:len(d.keys())-K:]))
### BUGGY CODE ###

import collections
import copy

N = int(input())
B = list(map(int, input().split()))
cp_B = copy.copy(B)
p = 0

setB = list(set(B))
num = len(setB)

for i in range(N):
  res = 0
  p = cp_B.pop(0)
  for j in range(num):
    if setB[j] == p:
      res += (B.count(setB[j])-1)*(B.count(setB[j])-2)/2
    else:
      res += B.count(setB[j])*(B.count(setB[j])-1)/2
  print(int(res))

### FIXED CODE ###

N = int(input())
B = list(map(int, input().split()))
count = {}

for i in B:
  if i in count:
    count[i] += 1
  else:
    count[i] = 1
    
total = 0
for i in count:
  total += count[i]*(count[i]-1)/2
  
for i in range(N):
  k = count[B[i]]
  print(int(total-k+1))
### BUGGY CODE ###

#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
def resolve():
    N,S=pin()
    A=tupin()#調子にのるな
    mod=998244353
    
    #形式的冪級数を考える
    #普通の部分和ッ->集合内の各アイテムについて、選ぶか選ばないか。O(2^n)の探索
    #これを形式的冪級数でいえば、（1+x^a）を掛ける計算になる　指数時間ではない
    #つまり、集合A,Sに対して、[x^s]PI(1+x^a_i) (f_i)

    #次に、Aの部分集合について考える
    #サンプル1の場合、N==3なので8個の部分集合がある
    #つまり、F3＝1+(f_1+f_2+f_3)+(f1_f2+f2_f3+f3_f1)+f1_f2_f3を考える
    #果たして、一般的なNにたいして多項式時間でにFnをもとめれば指数時間は完全回避できる
    #F3=(1+f1+f2+f1f2)+f3{(1+f1+f2+f1f2)}
    #  =(1+f3)(1+f1+f2+f1f2)
    #  =(f3で追加された新しいところ)(N=2のときのすべての部分集合)

    #これは、f3をSの部分集合にふくめるか、含めないかの探索と同等
    #一般的にFn=F_n-1*(1+fn)=PI(1+fn)とわかる

    #求めるものは[x^S]PI(1+fn)=[x^S]PI(2+x^a)

    from collections import defaultdict #本当は良くないがわかりやすさのためココに置く
    from copy import deepcopy
    
    ans=defaultdict(int)#i
    ans[0]=1 #init ,1=x^0より
    #print(ans)
    for a in A:
        #ans そのものと、ansの係数にx^aをかけたものを足し算    
        temp=defaultdict(int)
        for x in ans:
            temp[x+a]=ans[x]
            
            ans[x]*=2
            ans[x]%=mod
        for t in temp:
            ans[t]+=temp[t]
            ans[t]%=mod
    print(ans[S])    
        
    
    
#%%submit!
resolve()

### FIXED CODE ###

#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
def resolve():
    N,S=pin()
    A=tupin()#調子にのるな
    mod=998244353
    
    #形式的冪級数を考える
    #普通の部分和ッ->集合内の各アイテムについて、選ぶか選ばないか。O(2^n)の探索
    #これを形式的冪級数でいえば、（1+x^a）を掛ける計算になる　指数時間ではない
    #つまり、集合A,Sに対して、[x^s]PI(1+x^a_i) (f_i)

    #次に、Aの部分集合について考える
    #サンプル1の場合、N==3なので8個の部分集合がある
    #つまり、F3＝1+(f_1+f_2+f_3)+(f1_f2+f2_f3+f3_f1)+f1_f2_f3を考える
    #果たして、一般的なNにたいして多項式時間でにFnをもとめれば指数時間は完全回避できる
    #F3=(1+f1+f2+f1f2)+f3{(1+f1+f2+f1f2)}
    #  =(1+f3)(1+f1+f2+f1f2)
    #  =(f3で追加された新しいところ)(N=2のときのすべての部分集合)

    #これは、f3をSの部分集合にふくめるか、含めないかの探索と同等
    #一般的にFn=F_n-1*(1+fn)=PI(1+fn)とわかる

    #求めるものは[x^S]PI(1+fn)=[x^S]PI(2+x^a)

    from collections import defaultdict #本当は良くないがわかりやすさのためココに置く
    from copy import deepcopy
    
    ans=defaultdict(int)#i
    ans[0]=1 #init ,1=x^0より
    #print(ans)
    for a in A:
        #ans そのものと、ansの係数にx^aをかけたものを足し算    
        temp=defaultdict(int)
        for x in ans:
            if x+a<=S:
                temp[x+a]=ans[x]
            
            ans[x]*=2
            ans[x]%=mod
        for t in temp:
            if t<=S:
                ans[t]+=temp[t]
                ans[t]%=mod
    print(ans[S])    
    
#%%submit!
resolve()