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

N = int(input())
S = input()

ans = 0
for i in range(len(S)):    
    for j in range(i, len(S)): 
        if (S[i] != S[j]):
            for k in range(j, len(S)):
                if(S[k] != S[i] and S[k] != S[j]):
                    if (j - i != k - j):
                        ans+=1
print(ans)
    

### FIXED CODE ###

N = int(input())
S = input()

R = []
G = []
B = []
ans = 0
for i in range(len(S)):
    if S[i] == "R":
        R.append(i)
    if S[i] == "G":
        G.append(i)
    if S[i] == "B":
        B.append(i)
rem = 0
setB = set(B)

for r in R:
    for g in G:
        if g - abs(r - g) in setB:
            rem += 1
        if r - abs(g - r) in setB:
            rem += 1
        if (g + r) / 2 in setB:
            rem += 1
        if g + abs(r - g) in setB:
            rem += 1
        if r + abs(g - r) in setB:
            rem += 1


print(len(R)*len(G)*len(B) - rem)
### BUGGY CODE ###

N, Q = map(int, input().split())
S = input()
ans = []
for _ in range(Q):
    l, r = map(int, input().split())
    ans.append(S[l-1:r].count('AC'))

for a in ans:
    print(a)

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()

counts = [0]
c = 0
for i, s in enumerate(S[1:]):
    if (S[i] == 'A') and (s == 'C'):
        c += 1
    counts.append(c)

ans = []
for _ in range(Q):
    l, r = map(int, input().split())
    ans.append(counts[r-1] - counts[l-1])
    #ans.append(S[l-1:r].count('AC'))

for a in ans:
    print(a)
### BUGGY CODE ###

from math import factorial

#入力
n,a,b = map(int,input().split())

#答え用の関数
ans = 0
#Σ(k 1~n) nCk = 2^n
ans += pow(2,n,10**9+7)
nCa = (factorial(n)//(factorial(a)*factorial(n-a)))%(10**9+7)
nCb = (factorial(n)//(factorial(b)*factorial(n-b)))%(10**9+7)
ans -= (nCa+nCb+1)
ans = ans%(10**9+7)
print(ans)

### FIXED CODE ###

n,a,b = map(int,input().split())
m = 10**9+7

def nCr(n_, r_, m_):
  c = min(r_ , n_ - r_)
  bunshi = 1
  bunbo = 1
  for i in range(1,c+1):
    bunshi = bunshi * (n_+1-i) % m_
    bunbo = bunbo * i % m_
  return bunshi * pow(bunbo, m_-2, m_) % m_


ans = pow(2,n,m)-1
ans -= nCr(n,a,m)
ans %= m
ans -= nCr(n,b,m)
ans %= m
print(ans)
### BUGGY CODE ###

import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def make_divisors(n):
    l_divs, u_divs = [], []
    i = 1
    while i * i <= n:
        if n % i == 0:
            l_divs.append(i)
            if i != n // i:
                u_divs.append(n // i)
        i += 1
    return l_divs + u_divs[::-1]


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    aset = list(set(A))
    aset.sort()

    past = set()
    ans = 0
    ansset = set()
    for a in aset:
        divs = make_divisors(a)
        for div in divs:
            if div in past:
                break
        else:
            ansset.add(a)
            ans += 1

        past.add(a)

    c = collections.Counter(A)
    for cc in c.most_common():
        if cc[1] == 1:
            break

        if cc[1] > 1 and cc[0] in ansset:
            ans -= 1

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    aset = list(set(A))
    aset.sort()

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

    for a in aset:
        for i in range(2, 10 ** 6 + 1):
            if a * i > 10 ** 6:
                break
            ans[a * i] += 1

    res = 0
    c = collections.Counter(A)
    for a in A:
        if ans[a] == 0 and c[a] == 1:
            res += 1

    print(res)



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

import itertools,sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M = LI()
a = [I() for _ in range(M)]
dp = [0]*(N+1) #1_indexed
dp[0] = 1
dp[1] = 0 if 1 in a else 1
for i,j in itertools.product(range(2,N+1),[1,2]):
    if i in a:
        dp[i] = 0
        continue
    dp[i] += dp[i-j]
    dp[i] %= 10**9+7
print(dp[-1])


### FIXED CODE ###

def main(N,M,a):
    dp = [-1]*N
    dp[0] = 1
    if N != 1:
        dp[1] = 2
    for i in a:
        if i == 1:
            dp[0] = 0
            dp[1] = 1
        else:
            dp[i-1] = 0
    for i in range(2,N):
        if dp[i] != 0:
            dp[i] = dp[i-1] + dp[i-2]
    return dp[-1]
N,M = map(int, input().split())
a = list(int(input()) for i in range(M))

print(main(N,M,a) % 1000000007)
### BUGGY CODE ###

from collections import deque
H, W = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]
B = [list(map(int, input().split())) for _ in range(H)]
C = [[0]*W for _ in range(H)]
for i in range(H):
    for j in range(W):
        C[i][j] = A[i][j]-B[i][j]
M = 80*(H+W)
dp = [[[0]*(M*2+10) for i in range(W)] for j in range(H)]
dp[0][0][0] = 1
que = deque([(0, 0)])
while que:
    a, b = que.pop()
    c = C[a][b]
    if a<=H-2:
        for i in range(-M+c, M+1-c):
            if dp[a][b][i]:
                dp[a+1][b][i+c] = 1
                dp[a+1][b][i-c] = 1
        que.append((a+1, b))
    if b<=W-2:
        for i in range(-M+c, M+1-c):
            if dp[a][b][i]:
                dp[a][b+1][i+c] = 1
                dp[a][b-1][i-c] = 1
        que.append((a, b+1))
c = C[-1][-1]
ans = 10**10
for i in range(-M, M+1):
    if dp[-1][-1][i]:
        ans = min(ans, abs(i+c), abs(i-c))
print(ans)






### FIXED CODE ###

from collections import deque
H, W = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]
B = [list(map(int, input().split())) for _ in range(H)]
C = [[0]*W for _ in range(H)]
for i in range(H):
    for j in range(W):
        C[i][j] = abs(A[i][j]-B[i][j])
M = 80*(H+W)
dp = [[0 for i in range(W)] for j in range(H)]
c = C[0][0]
dp[0][0]+=(1<<(c+M))|(1<<(M-c))
for s in range(1, H+W):
    for b in range(max(s-H+1, 0), min(s+1, W)):
        a = s-b
        c = C[a][b]
        if a>=1:
            d = dp[a-1][b]
            dp[a][b]|=(d<<c)|(d>>c)
        if b>=1:
            d = dp[a][b-1]
            dp[a][b]|=(d<<c)|(d>>c)
ans = 10**10
d = dp[-1][-1]
for i in range(0, M*2+1):
    if 1<<i&d:
        ans = min(ans, abs(i-M))
print(ans)
### BUGGY CODE ###

n, m = map(int, input().split())
a = list(map(int, input().split()))
p = [list(map(int, input().split())) for i in range(m)]
cand = sorted(a)
ps = [c for b, c in sorted(p, key = lambda x : x[1], reverse = True) for _ in range(b)]
ans = 0
for candi, psi in zip(cand, ps):
    ans += max(candi, psi)
ans += sum(cand[len(ps):])
print(ans)


### FIXED CODE ###

n, m = map(int, input().split())
a = list(map(int, input().split()))
p = [list(map(int, input().split())) for i in range(m)]
cand = sorted(a)
ps =  sorted(p, key = lambda x : x[1], reverse = True)
i = 0
ans = 0
def calc():
    global i
    for b, c in ps:
        for d in range(b):
            if i + d == len(cand):
                return sum(cand)
            if cand[i + d] < c:
                cand[i + d] = c
            else:
                return sum(cand)
        i += b
    return sum(cand)
print(calc())
### BUGGY CODE ###

N, X, Y = map(int, input().split())
c = []
for i in range(1,N):
  for j in range(i+1,N+1):
    x = abs(X-i)
    y = abs(Y-j)
    a = min(x+y+1,j-i)
    c.append(a)
for i in range(1,N):
  ans = c.count(i)
  print(ans)
  


### FIXED CODE ###

N, X, Y = map(int, input().split())
c = [0 for i in range(N)]
for i in range(1,N):
  for j in range(i+1,N+1):
    x = abs(X-i)
    y = abs(Y-j)
    a = min(x+y+1,j-i)
    c[a]+=1

for i in range(1,N):
  ans = c[i]
  print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
    candidates = a[i+a[i]:]
    # print(candidates)
    for j in range(len(candidates)):
        if candidates[j] == j:
            ans += 1
print(ans)


### FIXED CODE ###

from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
d = defaultdict(int)
ans = 0
for i in range(n):
    ans += d[i-a[i]]
    d[i+a[i]] += 1
print(ans)
### BUGGY CODE ###

n = int(input())
 
n_max = 1
cnt_max = 0
for i in range(1, n + 1):
  cnt = 0
  a = i
  while(a % 2 == 0):
    a %= 2
    cnt += 1
  if cnt > cnt_max:
    cnt_max = cnt
    n_max = i
 
print(n_max)

### FIXED CODE ###

n = int(input())
 
n_max = 1
cnt_max = 0
for i in range(1, n + 1):
  cnt = 0
  a = i
  while(a % 2 == 0):
    a /= 2
    cnt += 1
  if cnt > cnt_max:
    cnt_max = cnt
    n_max = i
 
print(n_max)
### BUGGY CODE ###

import sys, itertools
input = sys.stdin.readline

def main():
    N = int(input())
    S = [s.rstrip() for s in sys.stdin.readlines()]
    memo = []
    count = 0
    for s in S:
        if s in memo:
            count += 1
        else:
            memo.append(s)
        
    print(N - count)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys, itertools
input = sys.stdin.readline

def main():
    N = int(input())
    S = [s.rstrip() for s in sys.stdin.readlines()]
    count = 0

    memo = sorted(S)

    for i in range(N - 1):
        if memo[i] == memo[i + 1]:
            count += 1
        
    print(N - count)

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

n, k = map(int, input().split())
a = list(map(int, input().split()))
mult = 1
str = 'Yes'
for i in range(k):
	mult *= a[i]
for i in range(k, n):
	str = 'Yes'
	if mult>=mult*a[i]/a[i-k]:	
		str = 'No'
	print(str)


### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(k, n):
	str = 'Yes'
	if a[i]<=a[i-k]:	
		str = 'No'
	print(str)
### BUGGY CODE ###

#!/usr/bin/env python3
s = input()
x = len(s)
for i in range(len(s)//2+1):
    s = s.replace('01', '')
    s = s.replace('10', '')
print(x - len(s))


### FIXED CODE ###

#!/usr/bin/env python3
s = input()
ans = 0
a = s.count('1')
b = s.count('0')
if a == 0 or b == 0:
    print(0)
    quit()
print(min(a, b)*2)
### BUGGY CODE ###

n,m = map(int,input().split())
r = []
ans = [True] * n
for i in range(m):
    ll,rr = map(int,input().split())
    a = set()
    for j in range(ll-1,rr):
        a.add(j)
    r.append(a)
for i in range(n):
    for j in range(m):
        if not i in r[j]:
            ans[i] = False
print(ans.count(True))


### FIXED CODE ###

import collections
n,m = map(int,input().split())
r = []
l = []
for i in range(m):
    ll,rr = map(int,input().split())
    r.append(rr)
    l.append(ll)
ans = min(r) - max(l) +1
if ans > 0:
    print(ans)
else :
    print(0)
### BUGGY CODE ###

import math

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

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

a.sort(reverse=True)
max_comb = 0
for i in range(min(10, n-1)):
    comb_sum = 0
    for j in a:
        if j < a[i]:
            comb_sum = combinations_count(a[i], j)
            if comb_sum > max_comb:
                max_comb = comb_sum
                comb_n = a[i]
                comb_r = j

print(comb_n, comb_r)

### FIXED CODE ###

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

a.sort(reverse=True)

num = a[0]

target = a[0]/2

diff = 1000000000000

for i in a:
    if i == num:
        continue
    dif = abs(target-i)
    if dif < diff:
        diff = dif
        num_2 = i

print(num, num_2)
### BUGGY CODE ###

def main():
    import sys
    input = sys.stdin.readline
    n,m,l = map(int,input().split())
    E = [[] for i in range(n)]
    for i in range(m):
        a,b,c = map(int,input().split())
        E[a-1].append((b-1,c))
        E[b-1].append((a-1,c))

    from collections import deque

    def bfs(s):
        dist = [[float("INF")]*2 for _ in range(n)]
        
        dist[s] = [0,l]
        q = deque([])
        q.append((0,s,l))
        
        while q:
            count,cur,fuel = q.popleft()
            for nex, nex_len in E[cur]:
                if fuel >= nex_len:
                    nex_fuel = fuel - nex_len
                    if dist[nex][0] > count or (dist[nex][0]==count and nex_fuel > dist[nex][1]):
                        q.append((count,nex,nex_fuel))
                        dist[nex] = [count,nex_fuel]
                else:
                    if l >= nex_len:
                        nex_fuel = l-nex_len
                        nex_count = count+1
                        if dist[nex][0] > nex_count or (dist[nex][0]==nex_count and nex_fuel > dist[nex][1]):
                            q.append((nex_count,nex,nex_fuel))
                            dist[nex] = [nex_count,nex_fuel]

        return dist


    ans = []
    for i in range(n):
        ans.append(bfs(i))
    
    x = int(input())
    for i in range(x):
        s,g = map(int,input().split())
        if ans[s-1][g-1][0] == float("INF"):
            print(-1)
        else:
            print(ans[s-1][g-1][0]) 
if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline
    n,m,l = map(int,input().split())
    E = [[float("INF")]*n for i in range(n)]
    for i in range(m):
        a,b,c = map(int,input().split())
        E[a-1][b-1] = c
        E[b-1][a-1] = c

    for k in range(n):
        for i in range(n):
            for j in range(n):
                E[i][j] = min(E[i][j],E[i][k]+E[k][j])
    wa = [[float("INF")]*n for i in range(n)]
    for i in range(n):
        for j in range(n):
            if E[i][j] <= l:
                wa[i][j] = 1
    for k in range(n):
        for i in range(n):
            for j in range(n):
                wa[i][j] = min(wa[i][j],wa[i][k]+wa[k][j])
    
    x = int(input())
    for i in range(x):
        s,g = map(int,input().split())
        if wa[s-1][g-1] == float("INF"):
            print(-1)
        else:
            print(wa[s-1][g-1]-1)

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

import bisect
N = int(input())
L = list(map(int, input().split()))
L.sort()

ans = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        res = L[i] + L[j]
        num = bisect.bisect_left(L[j+1:], res)
        ans += num
print(ans)

### FIXED CODE ###

import bisect

N = int(input())
L = list(map(int, input().split()))
L.sort()

cnt = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        cnt += bisect.bisect_left(L, L[i]+L[j]) - (j+1)

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

class Dict(object):

    m1 = 1046527
    m2 = m1 - 1

    def __init__(self):
        self._dict = ["" for _ in range(self.m1)]

    def insert(self, k):
        i = 0

        while True:
            ix = self._h(k, i)
            if self._dict[ix] == "":
                self._dict[ix] = k
                return
            else:
                i += 1

    def find(self, k):
        i = 0

        while True:
            ix = self._h(k, i)
            if self._dict[ix] == k:
                return ix
            elif self._dict[ix] == "":
                return -1
            else:
                i += 1

    def _h(self, k, i):
        return (self._h1(k) + i * self._h2(k)) % self.m1

    def _h1(self, k):
        return k % self.m1

    def _h2(self, k):
        return k % self.m2 + 1


def to_int(s):
    ret = 0
    i = 1
    for j in range(len(s)):
        e = s[len(s) - j - 1]

        if e == 'A':
            ret += 1 * i
        elif e == 'C':
            ret += 2 * i
        elif e == 'G':
            ret += 3 * i
        elif e == 'T':
            ret += 4 * i
        i *= 5

    return ret


if __name__ == '__main__':
    n = int(input())

    d = Dict()

    for _ in range(n):
        cmd, val = input().split()

        if cmd == "insert":
            d.insert(to_int(val))
        else:
            ans = "yes" if d.find(to_int(val)) != -1 else "no"
            print(ans)

### FIXED CODE ###

M = 1046527
L = 14
H = [""] * M
 
def getChar(ch):
    if ch == 'A':
        return 1
    elif ch == 'C':
        return 2
    elif ch == 'G':
        return 3
    elif ch == 'T':
        return 4
    else:
        return 0
 
def getKey(strings):
    Sum = 0
    p = 1
    for i in xrange(len(strings)):
        Sum += p * getChar(strings[i])
        p *= 5
 
    return Sum
 
def h1(key):
    return key % M
 
def h2(key):
    return 1 + (key % (M-1))
 
def find(strings):
    key = getKey(strings)
    i = 0
    while True:
        h = (h1(key) + i * h2(key)) % M
        if H[h] == strings:
            return 1
        elif len(H[h]) == 0:
            return 0
        else:
            i += 1
    return 0
 
def insert(strings):
    key = getKey(strings)
    i = 0
    while True:
        h = (h1(key) + i * h2(key)) % M
        if H[h] == strings:
            return 1
        elif len(H[h]) == 0:
            H[h] = strings
            return 0
        else:
            i += 1
    return 0
 
def main():
    n = input()
    for i in xrange(n):
        com = raw_input().split()
        if com[0][0] == 'i':
            insert(com[1])
        else:
            if find(com[1]):
                print 'yes'
            else:
                print 'no'
    return 0
 
main()
### BUGGY CODE ###

from operator import itemgetter

H, W, M = map(int, input().split())
h_count = [[i, 0] for i in range(H)]
w_count = [[i, 0] for i in range(W)]
exist = dict()
for _ in range(M):
    h, w = map(lambda x: int(x)-1, input().split())
    h_count[h][1] += 1
    w_count[w][1] += 1
    exist[(h, w)] = True

h_count.sort(key=itemgetter(1), reverse=True)
w_count.sort(key=itemgetter(1), reverse=True)
h_max = h_count[0][1]
w_max = w_count[0][1]
res = 0
is_dup = True
for h in h_count:
    if h[1] != h_max and is_dup:
        break
    for w in w_count:
        if w[1] != w_max and is_dup:
            break
        val = h[1] + w[1]
        if exist.get((h[0], w[0]), False):
            val -= 1
        else:
            is_dup = False
        res = max(res, val)
print(res)


### FIXED CODE ###

from operator import itemgetter

H, W, M = map(int, input().split())
h_count = [[i, 0] for i in range(H)]
w_count = [[i, 0] for i in range(W)]
exist = dict()
for _ in range(M):
    h, w = map(lambda x: int(x)-1, input().split())
    h_count[h][1] += 1
    w_count[w][1] += 1
    exist[(h, w)] = True

h_count.sort(key=itemgetter(1), reverse=True)
w_count.sort(key=itemgetter(1), reverse=True)
h_max = h_count[0][1]
w_max = w_count[0][1]
res = 0
is_dup = True
for h in h_count:
    if h[1] != h_max or not is_dup:
        break
    for w in w_count:
        if w[1] != w_max or not is_dup:
            break
        val = h[1] + w[1]
        if exist.get((h[0], w[0]), False):
            val -= 1
        else:
            is_dup = False
        res = max(res, val)
print(res)
### BUGGY CODE ###

# coding: utf-8
N,S=map(int,input().split())
A=list(map(int,input().split()))
MOD=998244353

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

dp[0][0]=1

for i in range(1,N+1):
    a=A[i-1]
    for j in range(0,S+1):
        dp[i][j]+=dp[i-1][j]*2
        if j-a>=0:
            dp[i][j]+=dp[i-1][j-a]
        dp[i][j]=dp[i][j]%MOD


print(dp[N][S])

### FIXED CODE ###

# coding: utf-8
N,S=map(int,input().split())
A=list(map(int,input().split()))
MOD=998244353

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

dp[0][0]=1

for i in range(1,N+1):
    a=A[i-1]
    for j in range(0,S+1):
        dp[i][j]+=dp[i-1][j]*2
        if j-a>=0:
            dp[i][j]+=dp[i-1][j-a]
        dp[i][j]=dp[i][j]%MOD


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

def sol():
    n=int(input())
    a=tuple(int(i) for i in input().split())
    ans=chk=0
    for i in range(min(a[0],a[-1])*2,-1,-2):
        ans=[0]*n
        ans[0]=i
        f=1
        for j in range(1,n):
            t=(a[j-1]-ans[j-1]//2)*2
            if t>=0 and (t+ans[j-1])//2==a[j-1]:
                ans[j]=t
            else:
                f=0
                break
        if f and ans[-1]//2+ans[-2]//2==a[-2] and ans[-1]//2+ans[0]//2==a[-1]:
            print(*ans)
            exit()

if __name__=="__main__":
    sol()

### FIXED CODE ###

# from https://atcoder.jp/contests/abc133/submissions/6272850
n=int(input())
a=[int(i) for i in input().split()]
c=[0]
s=sum(a)

for i in range(2*n):
    c.append(c[-1]+a[(i*2+1)%n])
ans=[0]*n
for i in range(n):
    ans[i*2%n]=s-2*(c[i+n//2]-c[i])
print(*ans)
### BUGGY CODE ###

S=[c for c in input()]
Q=int(input())
for i in range(Q):
    t=[a for a in input().split()]
    if t[0]=="1":
        S.reverse()
    else:
        if t[1]=="1":
            S.insert(0,t[2])
        else:
            S.append(t[2])
print("".join(S))            
    


### FIXED CODE ###

from collections import deque
S=deque([c for c in input()])
Q=int(input())
flg=True
for i in range(Q):
    l=[a for a in input().split()]
    if l[0]=="1": 
        flg=not flg
    else:
        if l[1]=="1":
            if flg:
                S.appendleft(l[2])
            else:
                S.append(l[2])
        else:
            if flg:
                S.append(l[2])
            else:
                S.appendleft(l[2])
print("".join(S) if flg else "".join(list(reversed(S))))
### BUGGY CODE ###

X, N = map(int, input().split())
if not N == 0:
  p_l = list(map(int, input().split()))
if N == 0:
  print(X)
  exit()
a = b = X
while True:
  if a in p_l and b in p_l:
    continue
  if not a in p_l:
    if not b in p_l:
      if a > b:
        print(b)
        exit()
      else:
        print(a)
        exit()
    print(a)
    exit()
  elif not b in p_l:
    if not a in p_l:
      if a > b:
        print(b)
        exit()
      else:
        print(a)
        exit()
    print(b)
  a += 1
  b -= 1

### FIXED CODE ###

X, N = map(int, input().split())
if not N == 0:
  p_l = list(map(int, input().split()))
if N == 0:
  print(X)
  exit()
a = b = X
if not a in p_l:
  if not b in p_l:
    if a > b:
      print(b)
      exit()
    else:
      print(a)
      exit()
  print(a)
  exit()
elif not b in p_l:
  if not a in p_l:
    if a > b:
      print(b)
      exit()
    else:
      print(a)
      exit()
  print(b)
while True:
  a += 1
  if b > 0:
    b -= 1
  if a in p_l and b in p_l:
    continue
  if not a in p_l:
    if not b in p_l:
      if a > b:
        print(b)
#        print("A")
        exit()
      else:
#        print("B")
        print(a)
        exit()
#    print("C")
    print(a)
    exit()
  elif not b in p_l:
    if not a in p_l:
      if a > b:
        print(b)
#        print("D")
        exit()
      else:
        print(a)
#        print("E")
        exit()
#    print("F")
    print(b)
    exit()
### BUGGY CODE ###

import numpy as np
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
k=np.array(list(Counter(a).keys()))
t=np.array(list(Counter(a).values()))
l=np.ones(len(t))
for i in range(n):
  s=np.copy(t)
  s[int(np.where(k==a[i])[0])]-=1
  print(int(sum(s*(s-l)//2)))

### FIXED CODE ###

from collections import Counter
n = int(input())
a = list(map(int, input().split()))
k = [0]*n
for i in a:
  k[i-1]+=1
g = 0
for i in range(n):
  g+=((k[i]*(k[i]-1))//2)
for i in a:
  print(g+1-k[i-1])
### BUGGY CODE ###

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

dp = [0] * (S + 1)
dp[0] = 1

for a in A:
    newDp = [d * 2 % MOD for d in dp]

    for s in range(S + 1):
        if s + a <= S:
            newDp[s + a] += dp[s]

    dp = newDp

print(dp[S] % MOD)


### FIXED CODE ###

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

dp = [0] * (S + 1)
dp[0] = 1

for a in A:
    newDp = [d * 2 % MOD for d in dp]

    for s in range(S + 1):
        if s + a <= S:
            newDp[s + a] += dp[s]

    dp = newDp

print(dp[S] % MOD)
### BUGGY CODE ###

import math
import time
start = time.time()
sum = 0
k= 200
for i in range(k):
    for j in range(k):
        for x in range(k):
            sum += math.gcd(x+1, math.gcd(i+1, j+1))

print(sum)

#print(time.time()-start)

### FIXED CODE ###

import math
sum = 0
k = int(input())+1
for i in range(1, k):
    for j in range(1, k):
        temp = math.gcd(i, j)
        for x in range(1, k):
            sum += math.gcd(temp, x)
print(sum)