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

import copy

def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y)

def cal(array):
  while(len(array) > 1):
    a = array.pop(0)
    b = array.pop(0)
    array.insert(0, gcd(a, b))
  return array[0]

def bSort(a):
  for i in range(len(a)):
    for j in range(len(a)-1, i, -1):
      if a[j] < a[j-1]:
        a[j], a[j-1] = a[j-1], a[j]

  return a

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


answer_list = []

for i in range(int(n)):
  copy_a = copy.copy(a)
  copy_pop_a = copy_a.pop(i)
  answer_list.insert(0, cal(copy_a))

answer = max(answer_list)

print(answer)


### FIXED CODE ###

import copy
import heapq
import fractions

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

gcd_l = [0]
gcd_r = [0]

for i in range(N):
  gcd_l.append(fractions.gcd(gcd_l[i], A[i]))
  gcd_r.append(fractions.gcd(gcd_r[i], A[-(i+1)]))

gcd_r = gcd_r[::-1]
ans = []

for i in range(N):
  ans.append(fractions.gcd(gcd_l[i], gcd_r[i+1]))

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

#

import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop

def main():
    mod = 10 ** 9 + 7
    s = list(input())
    n = len(s)
    s.reverse()

    dp = [[0] * 13 for _ in range(n + 1)]
    dp[0][0] = 1

    mul = 1
    for i, c in enumerate(s):
        for j in range(10):
            if (c.isdigit() and int(c) == j) or c == '?':
                m = (j * mul) % 13
                for k in range(13):
                    dp[i + 1][(m + k) % 13] += dp[i][k]
        for k in range(13):
            dp[i + 1][k] = dp[i + 1][k] % mod
        mul *= 10
    print(dp[n][5])


if __name__ == '__main__':
    main()


### FIXED CODE ###

#

import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop

def main():
    mod = 10 ** 9 + 7
    s = list(input())
    n = len(s)
    s.reverse()

    dp = [[0] * 13 for _ in range(n + 1)]
    dp[0][0] = 1

    mul = 1
    for i, c in enumerate(s):
        for j in range(10):
            if (c.isdigit() and int(c) == j) or c == '?':
                m = (j * mul) % 13
                for k in range(13):
                    dp[i + 1][(m + k) % 13] += dp[i][k]
        for k in range(13):
            dp[i + 1][k] = dp[i + 1][k] % mod
        mul *= 10
        mul %= 13
    print(dp[n][5])


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

import sys

def mkns(a,s,m):
    if a==0:
        return s
    else:
        return (((s+1)<<a)|s) & m

def main():
    N,K=map(int,sys.stdin.readline().strip().split())
    a=list(map(int,sys.stdin.readline().strip().split()))
    a.sort()
    ss=[0]*(N+1)
    pm=(1<<K)-1
    mask=lambda c:(1<<K)-(1<<c)
    nn=0
    for i in range(N):
        c=a[i]
        if c>=K:
            break
        ss[i+1]=mkns(c,ss[i],pm)
        a[i]=0
        for j in range(N):
            if a[j]>=K:
                break
            ss[i]=mkns(a[j],ss[i],pm)
        # print(bin(ss[i]), bin(mask(K-c)),ss[i]&mask(K-c))
        if ss[i]&mask(K-c)==0:
            nn+=1
    # print(list(map(bin,ss)))
    print(nn)

if __name__=='__main__':
    main()


### FIXED CODE ###

#4 9
#1 3 5 6
#の時に1（正解は0）と出力されるがACになる

N, K = map(int, input().split())
a=list(map(int, input().split()))
a.sort()
ans = N
t = 0
for i in range(N-1, -1, -1) :
  if t+a[i] < K:
    t += a[i]
  else:
    ans = min(ans, i)
print(ans)
### BUGGY CODE ###

from collections import deque
H, W, M = map(int, input().split())
bomb = []
counth = deque([0 for k in range(H)])
countw = deque([0 for k in range(W)])
for k in range(M):
  h, w = map(int, input().split())
  h -= 1
  w -= 1
  bomb.append(h+ w*H)
  counth[h] += 1 
  countw[w] += 1

def binary_search(list, item):
    low = 0
    high = len(list) - 1

    while low <= high:
        mid = (low + high) //2
        guess = list[mid]
        if guess == item:
            #return mid
            return True
        if guess > item:
            high = mid -1
        else:
            low = mid + 1

    return False


maxh = max(counth)
maxw = max(countw)
index_h = deque([])
index_w = []
k = 0
while k < H:
  h = counth.popleft()
  if h == maxh:
    index_h.append(k)
  k += 1
k = 0
while k < W:
  w = countw.popleft()
  if w == maxw:
    index_w.append(k)
  k += 1
ans = maxh + maxw - 1
lenh = len(index_h)
lenw = len(index_w)

if lenh*lenw > M:
  ans += 1
else:
  bomb.sort()
  kouho = []
  for i in range(lenh):
    h = index_h.pop()
    for j in range(lenw):
      w = index_w[j]
      kouho.append(h+ H*w)
  for K in kouho:
    if binary_search(bomb, K):
      continue
    else:
      ans += 1
      break
    
print(ans)


### FIXED CODE ###

from collections import deque
H, W, M = map(int, input().split())
bomb = []
counth = [0 for k in range(H)]
countw = [0 for k in range(W)]
for k in range(M):
  h, w = map(int, input().split())
  h -= 1
  w -= 1
  bomb.append(h+ w*H)
  counth[h] += 1 
  countw[w] += 1
counth = deque(counth)
countw = deque(countw)

def binary_search(list, item):
    low = 0
    high = len(list) - 1

    while low <= high:
        mid = (low + high) //2
        guess = list[mid]
        if guess == item:
            #return mid
            return True
        if guess > item:
            high = mid -1
        else:
            low = mid + 1

    #return None
    return False


maxh = max(counth)
maxw = max(countw)
index_h = deque([])
index_w = []
for k in range(H):
  h = counth.popleft()
  if h == maxh:
    index_h.append(k)

for k in range(W):
  w = countw.popleft()
  if w == maxw:
    index_w.append(k)

ans = maxh + maxw - 1
lenh = len(index_h)
lenw = len(index_w)


if lenh*lenw > M:
  ans += 1
else:
  bomb.sort()
  kouho = []
  for i in range(lenh):
    h = index_h.pop()
    for j in range(lenw):
      w = index_w[j]
      kouho.append(h+ H*w)
  for K in kouho:
    if binary_search(bomb, K):
      continue
    else:
      ans += 1
      break
    
print(ans)
### BUGGY CODE ###

N = int(input())
button_list =[]
for i in range(1,N+1):
  button_list.append([i,int(input())])
bond_list = [button_list[0][0]]
dest = 0
for i in range(N):
  bond_list.append(button_list[button_list[dest][1]-1][0])
  bond_list.append(button_list[button_list[dest][1]-1][1])
  dest = button_list[button_list[dest][1]-1][1]-1
  if 2 in bond_list:
    print(bond_list.index(2))
    break;
  if len(bond_list) >=3 and bond_list[len(bond_list)-1] == bond_list[len(bond_list)-3]:
    print(-1)
    break;
  
  

### FIXED CODE ###

N = int(input())
button_list =[]
for i in range(1,N+1):
  button_list.append(int(input()))

count = 0
dest = 1
for i in range(N):
    dest = button_list[dest - 1]
    count +=1
    if dest == 2:
        break;
if count == N:
    print(-1)
else:
    print(count)
### BUGGY CODE ###

def main():
  n = int(input())
  mod = 10**9+7
  a = []
  for i in range(n):
    a.extend(list(map(int,input().split())))
  dp = [0]*(1<<n)
  dp[0] = 1
  for S in range((1<<n)-1):
    k = bin(S).count("1")*n
    t = dp[S]
    if t:
      for i in range(n):
        if a[k+i]:
          dp[S|1<<i] = (dp[S|1<<i]+t)%mod
  print(dp[(1<<n)-1])
main()

### FIXED CODE ###

def main():
  n = int(input())
  mod = 10**9+7
  a = []
  for i in range(n):
    a.extend(list(map(int,input().split())))
  dp = [0]*(1<<n)
  dp[0] = 1
  for S in range((1<<n)-1):
    k = bin(S).count("1")*n
    t = dp[S]
    for i in range(n):
      if a[k+i]:
        dp[S|1<<i] = (dp[S|1<<i]+t)%mod
  print(dp[(1<<n)-1])
main()
### BUGGY CODE ###

n = int(input())
a = []
new_a = []

for k in range(n):
    a.append(str(input()))

for k in range(n):
    new_a.append( ''.join(list(sorted(a[k]))))

new_a.sort()

b = 0

for k in range(n-1):
    for m in range(k+1, n):
        if(new_a[k] == new_a[m]):
            b = b + 1

print(b)

### FIXED CODE ###

import math
n = int(input())
list_voc = [str(input()) for _ in range(n)]
list_mo = []
for i, s in enumerate(list_voc):
    list_n = list(s)
    list_n.sort()
    list_n = ''.join(list_n)
    list_mo.append(list_n)

ans = {}
for s in list_mo:
    if s in ans:
        ans[s] += 1
    else:
        ans[s] = 1


ans_val = []

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


for s in ans:
    if ans[s] != 1:
        ans_val.append(cmb(ans[s], 2))


print(sum(ans_val))
### BUGGY CODE ###

class my_dict:

    def __init__(self):
        self.d = []

    def insert(self, x):
        if (x not in self.d):
            self.d.append(x)

    def find(self, x):
        if (x in self.d):
            return 'yes'
        else:
            return 'no'


def main():
    n = int(input())
    my_d = my_dict()

    for i in range(n):
        command, string = input().split()
        if (command == 'insert'):
            my_d.insert(string)
        elif (command == 'find'):
            print(my_d.find(string))


if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    n = int(input())
    d = set([])


    for i in range(n):
        command, string = input().split()
        if (command == 'insert'):
            d.add(string)
        elif (command == 'find'):
            if string in d:
                print('yes')
            else:
                print('no')

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

import sys
input = sys.stdin.readline


class UnionFind():
    def __init__(self, n):
        self.parent = [-1 for _ in range(n)]

    def size(self, x):
        return -self.parent[self.find(x)]

    def find(self, x):
        if self.parent[x] < 0:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if (x == y):
            return False
        if self.size(x) < self.size(y):
            self.parent[y] += self.parent[x]
            self.parent[x] = y
        else:
            self.parent[x] += self.parent[y]
            self.parent[y] = x
        return True

    def same(self, x, y):
        return self.find(x) == self.find(y)


def main():
    N = int(input())
    x_list = []
    y_list = []
    x_app = x_list.append
    y_app = y_list.append
    for i in range(N):
        x, y = map(int, input().split())
        x_app([x, i])
        y_app([y, i])

    x_list.sort()
    y_list.sort()
    adj = []
    adj_app = adj.append
    for i in range(N-1):
        adj_app([x_list[i + 1][0] - x_list[i][0], x_list[i + 1][1], x_list[i][1]])
        adj_app([y_list[i + 1][0] - y_list[i][0], y_list[i + 1][1], y_list[i][1]])

    adj.sort()
    uf = UnionFind(N)
    ans = 0
    for edge in adj:
        weight, u, v = edge
        if not uf.same(u, v):
            ans += weight
            uf.unite(u, v)
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

# 6199094

import array
import sys
input = sys.stdin.readline

class UnionFind():
    def __init__(self,n):
        self.parent = [-1 for _ in range(n)]

    def size(self,x):
        return -self.parent[self.find(x)]

    def find(self,x):
        if(self.parent[x]<0):
            return x
        else:
            self.parent[x]=self.find(self.parent[x])
            return self.parent[x]

    def unite(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if(x == y):
            return False
        if(self.size(x)<self.size(y)):
            self.parent[y]+=self.parent[x]
            self.parent[x]=y
        else:
            self.parent[x]+=self.parent[y]
            self.parent[y]=x
        return True

    def same(self,x,y):
        return self.find(x)==self.find(y)

def main():
    N = int(input())
    xli = []
    yli = []
    x_app = xli.append
    y_app = yli.append


    for i in range(N):
        x,y = (int(x) for x in input().split())
        x_app([x-1,i])
        y_app([y-1,i])
    xli.sort()
    yli.sort()

    edges = []
    edges_app = edges.append
    for i in range(N-1):
        edges_app((xli[i][1],xli[i+1][1],xli[i+1][0]-xli[i][0]))
        edges_app((yli[i][1],yli[i+1][1],yli[i+1][0]-yli[i][0]))


    edges.sort(key=lambda edge: edge[2])
    uf = UnionFind(N)
    weight = 0

    for edge in edges:
        if not uf.same(edge[0], edge[1]):
            uf.unite(edge[0], edge[1])
            weight+=edge[2]
    print(weight)

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

#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin


class Node(object):
    def __init__(self, key=None):
        self.key = key
        self.parent = None
        self.left = None
        self.right = None


def tree_insert(top, z):
    y = None
    x = top
    while isinstance(x, Node):
        y = x
        if z.key < x.key:
            x = x.left
        else:
            x = x.right
    z.parent = y
    if y is None:
        top = z
    elif z.key < y.key:
        y.left = z
    else:
        y.right = z
    return top


def tree_find(node, key):
    if not node:
        return False
    if node.key == key:
        return True
    return tree_find(node.left, key) or tree_find(node.right, key)


def inorder_walk(node):
    if node.left:
        inorder_walk(node.left)
    print('', node.key, end='')
    if node.right:
        inorder_walk(node.right)


def preorder_walk(node):
    print('', node.key, end='')
    if node.left:
        preorder_walk(node.left)
    if node.right:
        preorder_walk(node.right)


n = int(stdin.readline())
#assert n <= 500000

top = None
for _ in range(n):
    cmd = stdin.readline()
    if cmd.startswith('i'):
        key = int(cmd[7:])
        #assert -2000000000 <= key <= 2000000000
        top = tree_insert(top, Node(key))
    elif cmd.startswith('f'):
        key = int(cmd[5:])
        r = tree_find(top, key)
        print('yes' if r else 'no')
    else:
        inorder_walk(top)
        print()
        preorder_walk(top)
        print()

### FIXED CODE ###

#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin


class Node(object):
    def __init__(self, key=None):
        self.key = key
        self.parent = None
        self.left = None
        self.right = None


def tree_insert(top, z):
    y = None
    x = top
    while isinstance(x, Node):
        y = x
        if z.key < x.key:
            x = x.left
        else:
            x = x.right
    z.parent = y
    if y is None:
        top = z
    elif z.key < y.key:
        y.left = z
    else:
        y.right = z
    return top


def tree_find(node, key):
    if not node:
        return False
    if node.key == key:
        return True
    if key < node.key:
        return tree_find(node.left, key)
    return tree_find(node.right, key)


def inorder_walk(node):
    if node.left:
        inorder_walk(node.left)
    print('', node.key, end='')
    if node.right:
        inorder_walk(node.right)


def preorder_walk(node):
    print('', node.key, end='')
    if node.left:
        preorder_walk(node.left)
    if node.right:
        preorder_walk(node.right)


n = int(stdin.readline())
#assert n <= 500000

top = None
for _ in range(n):
    cmd = stdin.readline()
    if cmd.startswith('i'):
        key = int(cmd[7:])
        #assert -2000000000 <= key <= 2000000000
        top = tree_insert(top, Node(key))
    elif cmd.startswith('f'):
        key = int(cmd[5:])
        r = tree_find(top, key)
        print('yes' if r else 'no')
    else:
        inorder_walk(top)
        print()
        preorder_walk(top)
        print()
### BUGGY CODE ###

from itertools import permutations, product

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

R_indices = [i for i in range(N) if S[i] == "R"]
G_indices = [i for i in range(N) if S[i] == "G"]
B_indices = [i for i in range(N) if S[i] == "B"]

count = 0
for indices_tuple in permutations([R_indices, G_indices, B_indices]):
    for i, j, k in product(*indices_tuple):
        if i < j < k and j - i != k - j:
            count += 1

print(count)

### FIXED CODE ###

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

r_num = S.count("R")
g_num = S.count("G")
b_num = S.count("B")

count = 0
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        k = j * 2 - i
        if k >= N:
            continue
        si, sj, sk = S[i], S[j], S[k]
        if si != sj and sj != sk and sk != si:
            count += 1

print(r_num * g_num * b_num - count)
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
# print(A)
A = [[A[i],i] for i in range(N)]
A.sort(reverse=True)
# print("A :",A)
dp = [[0]*(N+1) for _ in range(N+1)]
# print(dp)

#dp[x][y] : x人は Ai*(i-pi),y人は Ai*(pi-i)
#           piは 0,1,2...   piはN-1,N-2,N-3,,
dp[0][0] = 0
# y = 0
for x in range(1,N+1):
    dp[x][0] = dp[x-1][0]+A[x-1][0]*(A[x-1][1]-x+1)
    # print(x,dp)
# x = 0
for y in range(1,N+1):
    dp[0][y] = dp[0][y-1]+A[y-1][0]*(N-y - A[y-1][1])
    # print(x,dp)
    
for x in range(1,N):
    for y in range(1,N+1-x):
        dp[x][y] = max(dp[x-1][y] + A[x+y-1][0]*(A[x+y-1][1]+1 - x), dp[x][y-1] + A[x+y-1][0]*(N-y - A[x+y-1][1]))
# print(dp)

c = 0
for i in range(N):
    if c < dp[i][N-i]:
        c = dp[i][N-i]
print(c)

### FIXED CODE ###

# import time
# p0 = time.time()

N = int(input())
A = list(map(int,input().split()))
# print(A)
A = [[A[i],i] for i in range(N)]
A.sort(reverse=True)
# print("A :",A)
dp = [[0]*(N+1) for _ in range(N+1)]
# print(dp)

#dp[x][y] : x人は Ai*(i-pi),y人は Ai*(pi-i)
#           piは 0,1,2...   piはN-1,N-2,N-3,,
# p1 = time.time()-p0

dp[0][0] = 0
# y = 0
for x in range(1,N+1):
    dp[x][0] = dp[x-1][0]+A[x-1][0]*(A[x-1][1]-x+1)
    # print(x,dp)
# x = 0
for y in range(1,N+1):
    dp[0][y] = dp[0][y-1]+A[y-1][0]*(N-y - A[y-1][1])
    # print(x,dp)

# p2 = time.time()-p0
for x in range(1,N):
    for y in range(1,N+1-x):
        A0 = A[x+y-1][0]
        A1 = A[x+y-1][1]
        dp[x][y] = max(dp[x-1][y] + A0*(A1+1 - x), dp[x][y-1] + A0*(N-y - A1))
# print(dp)

# p3 = time.time()-p0

c = 0
for i in range(N):
    if c < dp[i][N-i]:
        c = dp[i][N-i]
print(c)

# print(p1,p2,p3)
### BUGGY CODE ###

List = list(map(int,input().split()))

A = List[0]
B = List[1]

Flag = False
for K in range(int((A+B)/2) + 1):
    if abs(A-K) == abs(B-K):
        count = K
        Flag = True

if Flag == True:
    print(K)
else:
    print("IMPOSSIBLE")

### FIXED CODE ###

List = list(map(int,input().split()))

A = List[0]
B = List[1]

Flag = False
if (A + B) % 2 == 0:
    K = int((A + B)/2)
    Flag = True

if Flag == True:
    print(K)
else:
    print("IMPOSSIBLE")
### BUGGY CODE ###

s = input()
result = 0
while True:
  t = len(s)
  for i in range(len(s) - 1):
    if s[i] != s[i + 1]:
      result += 2
      s = s[:i] + s[i+2:]
      break
  if len(s) == t:
    break
print(result)


### FIXED CODE ###

s = input()
t = len([c for c in s if c == '0'])
print(2 * min(t, len(s) - t))
### BUGGY CODE ###

import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    dl=list(map(int,input().split()))
    m=int(input())
    tl=list(map(int,input().split()))
    ans='YES'
    for i in tl:
        if i not in dl:
            ans='NO'
            break
        if i in dl:
            dl.remove(i)
    print(ans)
resolve()

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():

        n=int(input())
        d=list(map(int,input().split()))
        m=int(input())
        t=list(map(int,input().split()))
        from collections import Counter
        dd=Counter(d)
        tt=Counter(t)
        for key,value in tt.items():
            if dd[key]<value:
                return 'NO'
        return 'YES'
    print(main())
resolve()
### BUGGY CODE ###

INT_MAX = 10**8
h, n = map(int, input().split())
e = [tuple(map(int, input().split())) for _ in range(n)]

dp = [0] + [INT_MAX]* h
for i in range(1, h+1):
  for a, b in e:
    c = dp[max(0, i - a)] + b
    dp[i] = min(dp[i], c)

print(dp[h])

### FIXED CODE ###

INT_MAX = 10**8
h, n = map(int, input().split())
e = tuple(tuple(map(int, input().split())) for _ in range(n))

dp = [INT_MAX] * (h+1)
dp[0] = 0
for i in range(1, h+1):
  for a, b in e:
    c = dp[max(0, i - a)] + b
    dp[i] = min(dp[i], c)

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

from itertools import accumulate
from collections import Counter

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

B = [0] + list(accumulate(A))

ans = 0
for i in set(B):
    p = Counter(B)[i]
    ans += p*(p-1)//2

print(ans)


### FIXED CODE ###

from itertools import accumulate
from collections import Counter

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

B = [0] + list(accumulate(A))
C = Counter(B)

ans = 0
for i in set(B):
    p = C[i]
    ans += p*(p-1)//2

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

n,k=map(int,input().split())
a=list(map(int,input().split()))
f=[[0 for j in range(60)] for i in range(n)]
for i in range(len(a)):
    a[i]-=1
    f[i][0]=a[i]
#do binary lifting 
for j in range(1,60):
    for i in range(n):
        f[i][j]=f[f[i][j-1]][j-1]
ans=0
for j in range(59,-1,-1):
    if 1<<j<=k:
        ans=f[ans][j]
        k-=1<<j
print(ans+1)


### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
f=[[0 for j in range(60)] for i in range(n)]
for i in range(len(a)):
    a[i]-=1
    f[i][0]=a[i]
#do binary lifting 
for j in range(1,60):
    for i in range(n):
        f[i][j]=f[f[i][j-1]][j-1]
ans=0
for j in range(59,-1,-1):
    if 1<<j<=k:
        ans=f[ans][j]
        k-=1<<j
print(ans+1)
### BUGGY CODE ###

n = int(input())
s = input()
r, g, b = 0, 0, 0
for i in s:
    if i == 'R':
        r += 1
    elif i == 'G':
        g += 1
    else:
        b += 1
bad = 0
for i in range(n):
    gap = 0
    while i+(gap+1)*2 <= n-1:
        if s[i] != s[i+gap+1] and s[i+gap+1] != s[i+(gap+1)*2]\
                and s[i] != s[i+(gap+1)*2]:
            bad += 1
        gap += 1
print(r*g*b-bad) 


### FIXED CODE ###

n = int(input())
s = input()
r, g, b = 0, 0, 0
for i in s:
    if i == 'R':
        r += 1
    elif i == 'G':
        g += 1
    else:
        b += 1
bad = 0
for i in range(n):
    gap = 0
    while i+(gap+1)*2 <= n-1:
        if s[i] != s[i+gap+1] and s[i+gap+1] != s[i+(gap+1)*2]\
                and s[i] != s[i+(gap+1)*2]:
            bad += 1
        gap += 1
print(r*g*b-bad)
### BUGGY CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
a=[(1+i)/2 for i in a]
b=[0]*(n-k+1)
for i in range(n-k+1):
    b[i]=(sum(a[i:i+k]))
print(max(b))

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
#a=[(1+i)/2 for i in a]
import itertools
ac=itertools.accumulate(a)
ac=list(ac)

ans=0
for i in range(k-1,n):
    if i-k>=0:
        tmp=ac[i]-ac[i-k]
    else:
        tmp=ac[i]
    ans=max(ans,tmp)

print((ans+k)/2)
### BUGGY CODE ###

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

        l = []

        for i in range(N-1):
                l.append(A.count(i+1))
        l.append(0)

        [print(n) for n in l]

if __name__=="__main__":
        main()

### FIXED CODE ###

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

        l = [0]*N

        for a in A:
                l[a-1] += 1

        ans = "\n".join([str(x) for x in l])
        print(ans)

if __name__=="__main__":
        main()