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

# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect


def zz():
    return list(map(int, input().split()))


def z():
    return int(input())


def S():
    return input()


def C(line):
    return [input() for _ in range(line)]


N = z()
a = zz()
ans = []
for i in range(N):
    tmp_ans = 0
    lis = a[:i] + a[i+1:]
    for ai in lis:
        tmp_ans ^= ai
    ans.append(tmp_ans)

print(*ans)
# i番目以外のxorの合計がai


### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect


def zz():
    return list(map(int, input().split()))


def z():
    return int(input())


def S():
    return input()


def C(line):
    return [input() for _ in range(line)]


N = z()
a = zz()
ans = []
all_xor = 0
for _a in a:
    all_xor ^= _a

for i in range(N):
    tmp = -(all_xor ^ (~a[i])) - 1
    ans.append(tmp)
print(*ans)
# i番目以外のxorの合計がai
### BUGGY CODE ###

from itertools import permutations
N,L = map(int,input().split())
strs = [input() for i in range(N)]
result = list(permutations(strs,N))
result.sort()
print("".join(result[0]))


### FIXED CODE ###

N,L = map(int,input().split())
strs = [input() for i in range(N)]
strs.sort()
print("".join(strs))
### BUGGY CODE ###

from itertools import permutations as perm
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


def yesno(v, yes="Yes", no="No", upper=False):
    if upper:
        print([yes.upper(), no.upper()][not v])
    else:
        print([yes, no][not v])


def main():
    """エントリーポイント"""
    N = input(int)
    primes = [2]
    for x in range(3, 100000 + 100, 2):
        for p in primes:
            if x % p == 0:
                break
        else:
            primes.append(x)
    for p in primes:
        if N <= p:
            print(p)
            break


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()


### FIXED CODE ###

from itertools import permutations as perm
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


def yesno(v, yes="Yes", no="No", upper=False):
    if upper:
        print([yes.upper(), no.upper()][not v])
    else:
        print([yes, no][not v])


def main():
    """エントリーポイント"""
    N = input(int)
    primes = [2]
    for x in range(3, 100000 + 100, 2):
        for p in primes:
            if x % p == 0:
                break
        else:
            primes.append(x)
    for p in primes:
        if N <= p:
            print(p)
            break


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()
### BUGGY CODE ###

n,q = map(int,input().split())
s = input()
l = [list(map(int,input().split())) for i in range(q)]
count = 0
for i in range(q):
    for j in range(l[i][1]-l[i][0]):
        if s[l[i][0]+j-1] == 'A' and s[l[i][0]+j] == 'C':
            count += 1
    print(count)
    count = 0


### FIXED CODE ###

n,q = map(int,input().split())
s = input()
t = [0]*(n+1)
for i in range(n):
    t[i+1] = t[i] + (1 if s[i:i+2]=="AC" else 0)
for i in range(q):
    l,r = map(int,input().split())
    print(t[r-1]-t[l-1])
### BUGGY CODE ###

N,M=map(int, input().split())
import sys
def input(): return sys.stdin.readline().strip()
A=sorted(map(int, input().split()))
BC=sorted([list(map(int,input().split())) for i in range(M)],key=lambda x: x[1],reverse=True)
from bisect import bisect_left
ans=0
numans=0
for m in range(M):
    r=bisect_left(A,BC[m][1])
    if r:
        num=min(r,BC[m][0])
        ans=ans+sum(A[r:])+BC[m][1]*num
        numans+=len(A[r:])+num
        A=A[num:r]
    else:
        break
ans+=sum(A[-(N-numans):])
print(ans)

### FIXED CODE ###

N,M=map(int, input().split())
import sys
def input(): return sys.stdin.readline().strip()
A=list(map(int, input().split()))
BC=[list(map(int,input().split())) for i in range(M)]
A.sort()
BC.sort(key=lambda x: x[1],reverse=True)
from bisect import bisect_left
ans=0
l=0
for m in range(M):
    if BC[m][0]<len(A)-l and A[BC[m][0]+l]<BC[m][1]:
        ans=ans+BC[m][1]*BC[m][0]
        l+=BC[m][0]
    else:     
        r=bisect_left(A[l:],BC[m][1])
        if r:
            ans=ans+BC[m][1]*r
            l+=r
        break
ans+=sum(A[l:])
print(ans)
### BUGGY CODE ###

N = int(input())
power = 1

for i in range(N):
	power = power * (i + 1)

print(power % (10**9 + 7))

### FIXED CODE ###

N = int(input())
power = 1

for i in range(N):
	power = power * (i + 1) % (10**9 + 7)

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

n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))
dp = [[None]*(n+1) for i in range(64)]
for i in range(1, n+1):
    dp[0][i] = a[i]
for i in range(63):
    for j in range(1, n+1):
        dp[i+1][j] = dp[i][dp[i][j]]

k = format(k, "064b")
now = 1
for i in range(64):
    if k[i] == "1":
        now = dp[~i][now]

print(now)


### FIXED CODE ###

n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))

loop = [1]
now = 1
d = set([1])
for i in range(n):
    now = a[now]
    if now in d:
        for j in range(len(loop)):
            if now == loop[j]:
                ind = j
        break
    d.add(now)
    loop.append(now)

if len(loop) >= k+1:

    print(loop[k])

else:
    k -= ind
    loop = loop[ind:]
    print(loop[k%len(loop)])
### BUGGY CODE ###

N=int(input())
A=[]
for i in range(N):
    A.append(int(input()))
    
    
    
import copy
U=copy.deepcopy(A)
del U[U.index(max(U))]
X=max(U)
Q=max(A)
for i in range(N):
    if i==A.index(Q):
        print(X)
    else:
        print(Q)

### FIXED CODE ###

N=int(input())
A=[]
for i in range(N):
    A.append(int(input()))
    
    
import copy
U=copy.deepcopy(A)
del U[U.index(max(U))]
X=max(U)
Q=max(A)
Z=A.index(Q)
for i in range(N):
    if i==Z:
        print(X)
    else:
        print(Q)
### BUGGY CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = list(map(int, readline().split()))
B1 = [0 for i in range(60)]
for x in A:
    bA = format(x,"b").zfill(60)
    for i in range(60):
        if bA[i] == "1":
            B1[i] += 1
ans = 0
for i,x in enumerate(B1):
    ans = (ans + 2**(59-i)*x*(N-x)) % (10**9+7)
print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split(' ')))
B1 = [0 for i in range(60)]
B0 = [0 for i in range(60)]
for x in A:
    bA = format(x,"b").zfill(60)
    for i in range(60):
        if bA[i] == "1":
            B1[i] += 1
        elif bA[i] == "0":
            B0[i] += 1
ans = 0
for i in range(60):
    ans = (ans + 2**(59-i)*B1[i]*B0[i]) % (10**9+7)
print(ans)
### BUGGY CODE ###

L, R = map(int, input().split())
  
min = 2019

for i in range(L, R):
  for j in range(i+1, R+1):
    if (j - i >= 2019):
      break
    
    result = (i * j) % 2019

    if (result < min):
      min = result
      if (min == 0):
        break
            
print(min)

### FIXED CODE ###

L, R = map(int, input().split())
  
min = 2018

for i in range(L, R):
  for j in range(L + 1, R + 1):
    result = (i * j) % 2019
    if (result < min):
      min = result
      if min == 0:
        break
  if min == 0:
    break
    
print(min)
### BUGGY CODE ###

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n = INT()
p = LIST()
ans = 0
#arr = [0 for _ in range(n)]
arr2 = [0 for _ in range(n)]
for i in range(n):
    for j in range(p[i]):
        arr2[j] += 1
    ans += 1 if arr2[p[i] - 1] == i + 1 else 0
    #print(i+1, arr, sum(arr[p[i] - 1:]), sum(arr[p[i] - 1:]) == i + 1)
print(ans)

### FIXED CODE ###

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n = INT()
p = LIST()
ans = 0
arr = [inf for _ in range(n)]
arr[0] = p[0]
for i in range(1, n):
    arr[i] = min(p[i], arr[i-1])
#print(arr)
for i in range(n):
    ans += 1 if arr[i] == p[i] else 0
    #print(i+1, arr, sum(arr[p[i] - 1:]), sum(arr[p[i] - 1:]) == i + 1)
print(ans)
### BUGGY CODE ###

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

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

maxi = 0
# print(n*99//100)
for i in range(n-1, n*99//100-1, -1):
    key = a[i] // 2
    ok = n
    ng = -1
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if key <= a[mid]: ok = mid
        else: ng = mid
    if ok < i: 
        if comb(a[i], a[ok]) > maxi:
            maxi = comb(a[i], a[ok])
            ans = [a[i], a[ok]]
    if ng >= 0: 
        if comb(a[i], a[ng]) > maxi:
            maxi = comb(a[i], a[ng])
            ans = [a[i], a[ng]]
print("{} {}". format(ans[0], ans[1]))

### FIXED CODE ###

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

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

maxi = 0
i = -1
key = a[i] // 2
for j in range(n):
    if a[j] > key:
        break
# print(j, n-1)
# print(j, key, a)
if abs(a[j-1] - key) >= abs(a[j] - key) and j < n-1:
    ans = [a[i], a[j]]
else:
    ans = [a[i], a[j-1]]
# ok = n
# ng = -1
# while abs(ok - ng) > 1:
#     mid = (ok + ng) // 2
#     if key <= a[mid]: ok = mid
#     else: ng = mid
# if ok < i: 
#     if comb(a[i], a[ok]) > maxi:
#         maxi = comb(a[i], a[ok])
#         ans = [a[i], a[ok]]
# if ng >= 0: 
#     if comb(a[i], a[ng]) > maxi:
#         maxi = comb(a[i], a[ng])
#         ans = [a[i], a[ng]]
print("{} {}". format(ans[0], ans[1]))
### BUGGY CODE ###

#!/usr/bin/env python3
import sys

YES = "Yes"
NO = "No"

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

def prod(A):
    ans = A[0]
    for i in range(1,len(A)):
        ans = ans * A[i]
    return ans

scores = [0] * K
pre = 0
for i in range(N):
    scores[i % K] = A[i]
    cur = prod(scores)

    if i >= K:
        if cur > pre:
            print(YES)
        else:
            print(NO)
    pre = cur


### FIXED CODE ###

#!/usr/bin/env python3
import sys

YES = "Yes"
NO = "No"

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

scores = [0] * K
scores[0] = A[0]
i = 1
while i < K:
    scores[i] = A[i]
    i += 1

while i < N:
    if A[i] > scores[i % K]:
        print(YES)
    else:
        print(NO)
    scores[i % K] = A[i]
    i += 1
### BUGGY CODE ###

import math


def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0  # 1は素数ではない
    x_sqrt = math.sqrt(x)  # 記憶させていちいち計算しない

    # エラトステネスのふるい
    for prime in primes:
        if prime == 0: continue  # 先に処理
        if prime > x_sqrt: break
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]


def twoprimes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0  # 1は素数ではない
    x_sqrt = math.sqrt(x)  # 記憶させていちいち計算しない

    # エラトステネスのふるい
    for prime in primes:
        if prime == 0: continue  # 先に処理
        if prime > x_sqrt: break
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime*2-1 for prime in primes if prime != 0]


q = int(input())
array = [[int(x) for x in input().split()] for x in range(q)]
primes_array = set(primes(10000))
twoprimes_array = set(twoprimes(10000))

for item in array:
    tmp = range(item[0], item[1]+1, 2)
    res = set(tmp) & primes_array
    twores = set(tmp) & twoprimes_array
    print(len(res & twores))

### FIXED CODE ###

import math
import bisect


def is_prime(x):
    if x < 2: return False # 2未満に素数はない
    if x == 2 or x == 3 or x == 5: return True # 2,3,5は素数
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0: return False # 2,3,5の倍数は合成数

    # ためし割り: 疑似素数(2でも3でも5でも割り切れない数字)で次々に割っていく
    prime = 7
    step = 4
    while prime <= math.sqrt(x):
        if x % prime == 0: return False

        prime += step
        step = 6 - step

    return True


if __name__ == '__main__':
    q = int(input())
    array = [[int(x) for x in input().split()] for x in range(q)]
    nearby_2017 = [x for x in range(1, 100000, 2) if is_prime(x) and is_prime((x+1)/2)]
    for i, j in array:
        print(bisect.bisect_right(nearby_2017, j) - bisect.bisect_left(nearby_2017, i))
### BUGGY CODE ###

N, M = map(int,input().split())
C=[[0 for _ in range(2)] for _ in range(M)]
for i in range(M):
  C[i][0], C[i][1] = map(int,input().split())
D = sorted(C,key = lambda x:x[1])
D.sort(key = lambda x:x[0])
count = [0 for _ in range(M)]
for i in range(M):
  if i == 0:
    count[i]=1
  else:
    if D[i][0]==D[i-1][0]:
      count[i] += count[i-1]+1
    else:
      count[i]=1
for i in C:
  index = D.index(i)
  print("{:06}{:06}".format(i[0],count[index]))

### FIXED CODE ###

N, M = map(int,input().split())
C=[0 for _ in range(M)]
count = [0 for _ in range(N)]
for i in range(M):
  p,y = map(int,input().split())
  C[i] = [i, p, y, 0]

C.sort(key = lambda x:x[2])
for i in C:
  count[i[1]-1] +=1
  i[3] = count[i[1]-1]
for i in sorted(C,key = lambda x:x[0]):
  print("{:06d}{:06d}".format(i[1],i[3]))
### BUGGY CODE ###

from collections import deque

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

g = [[] for _ in range(n)]
indeg = [0 for _ in range(n)]

for _ in range(m):
    x, y = map(int, input().split())
    g[x-1].append(y-1)
    indeg[y-1] += 1

q = deque([])
dp = [-1 for _ in range(n)]

for i in range(n):
    if indeg[i] == 0:
        q.append(i)
        dp[i] = 0

while q:
    v = q.popleft()
    for w in g[v]:
        if dp[w] < dp[v]+1:
            dp[w] = dp[v]+1
            q.append(w)

print(max(dp))



### FIXED CODE ###

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

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

g = [[] for _ in range(n)]
indeg = [0 for _ in range(n)]

for _ in range(m):
    x, y = map(int, input().split())
    g[x-1].append(y-1)
    indeg[y-1] += 1

dp = [-1 for _ in range(n)]


def LP(v):
    if dp[v] != -1:
        return dp[v]
    ans = 0
    for w in g[v]:
        ans = max(ans, LP(w)+1)
    dp[v] = ans
    return dp[v]


for i in range(n):
    LP(i)

print(max(dp))
### BUGGY CODE ###

n = int(input())
A = []
march = ['M', 'A', 'R', 'C', 'H']
for _ in range(n):
    s = input()
    if s[0] in march:
        A.append(s)

# 同じ文字から始まらない 3 人の選び方
from itertools import combinations

cnt = 0
for v in combinations(A, 3):
    if v[0][0] == v[1][0] or v[1][0] == v[2][0] or v[2][0] == v[0][0]:
        continue
    cnt += 1
print(cnt)

### FIXED CODE ###

n=int(input())
a=[0]*5
for i in range(n):
    s=input()
    if s[0]=='M': a[0]+=1
    elif s[0]=='A': a[1]+=1
    elif s[0]=='R': a[2]+=1
    elif s[0]=='C': a[3]+=1
    elif s[0]=='H': a[4]+=1
res=0
for i in range(3):
    for j in range(i+1,4):
        for k in range(j+1,5):
            res+=a[i]*a[j]*a[k]
print(res)
### BUGGY CODE ###

n = int(input())
s = input()
ans = 0
lis = [0]*1000
for i in range(n):
  for j in range(i+1, n):
    for k in range(j+1, n):
      num = int("".join([s[i],s[j],s[k]]))
      #print(num)
      if lis[num]==0:
        ans+=1
        lis[num]=1
print(ans)

### FIXED CODE ###

n = int(input())
s = input()
ans = 0
lis = [0]*1000
one = [0]*10
two = [0]*100

for i in range(n):
  temp1 = int(s[i])
  if one[temp1]==1:
    continue
  else:
    one[temp1]=1
 
  for j in range(i+1, n):
    temp2 =  int("".join([s[i], s[j]]))
    if two[temp2]==1:
      continue
    else:
      two[temp2]=1
    
    for k in range(j+1, n):
      pin=int("".join([s[i], s[j], s[k]]))
      if lis[pin]==0:
        ans+=1
        lis[pin]=1
print(ans)
### BUGGY CODE ###

s = input()
dp = [[0, 0] for i in range(len(s))]
dp[0][0] = int(s[0])
dp[0][1] = 11 - int(s[0])
for i in range(1, len(s)):
  dp[i][0] = min(dp[i - 1][0], dp[i - 1][1]) + int(s[i])
  dp[i][1] = min(dp[i - 1][0] + 11 - int(s[i]), dp[i - 1][1] + 9 - int(s[i]))
print(min(dp[-1][0], dp[-1][1]))

### FIXED CODE ###

s = input()
l = list(s)
l = [int(x) for x in l]
dp = [[0, 0] for i in range(len(s))]
dp[0][0] = l[0]
dp[0][1] = 11 - l[0]
for i in range(1, len(s)):
  dp[i][0] = min(dp[i - 1][0], dp[i - 1][1]) + l[i]
  dp[i][1] = min(dp[i - 1][0] + 11 - l[i], dp[i - 1][1] + 9 - l[i])
print(min(dp[-1][0], dp[-1][1]))
### BUGGY CODE ###

import sys
input=sys.stdin.readline
from collections import deque
class ctmp():
    def __init__(self,ij,dis):
        self.ij=ij
        self.dis=dis
H,W=map(int,input().split())
ls=["#"*(W+2)]
for i in range(H):
    ls.append("#"+input()+"#")
ls.append("#"*(W+2))
q=deque([])
tmp=ctmp((1,1),0)
q.append(tmp)
df={}
while q:
    tmp=q.popleft()
    df[tmp.ij]=1
    if tmp.ij==(H,W):
        break
    if (tmp.ij[0]-1,tmp.ij[1]) not in df and ls[tmp.ij[0]-1][tmp.ij[1]]==".":
        c_tmp=ctmp((tmp.ij[0]-1,tmp.ij[1]),tmp.dis+1)
        q.append(c_tmp)
    if (tmp.ij[0]+1,tmp.ij[1]) not in df and ls[tmp.ij[0]+1][tmp.ij[1]]==".":
        c_tmp=ctmp((tmp.ij[0]+1,tmp.ij[1]),tmp.dis+1)
        q.append(c_tmp)
    if (tmp.ij[0],tmp.ij[1]-1) not in df and ls[tmp.ij[0]][tmp.ij[1]-1]==".":
        c_tmp=ctmp((tmp.ij[0],tmp.ij[1]-1),tmp.dis+1)
        q.append(c_tmp)
    if (tmp.ij[0],tmp.ij[1]+1) not in df and ls[tmp.ij[0]][tmp.ij[1]+1]==".":
        c_tmp=ctmp((tmp.ij[0],tmp.ij[1]+1),tmp.dis+1)
        q.append(c_tmp)
if tmp.ij==(H,W):
    nw=0
    for i in range(1,H+1):
        for j in range(1,W+1):
            if ls[i][j]==".":
                nw+=1
    print(nw-tmp.dis-1)
else:
    print(-1)

### FIXED CODE ###

def main():
    import sys
    input=sys.stdin.readline
    from collections import deque
    #class ctmp():
    #    def __init__(self,ij,dis):
    #        self.ij=ij
    #        self.dis=dis
    H,W=map(int,input().split())
    ls=["#"*(W+2)]#
    for i in range(H):
        ls.append("#"+input()+"#")
    ls.append("#"*(W+2))#
    q=deque([])
    #qd=deque([])
    #tmp=ctmp((1,1),0)
    q.append((1,1))
    #qd.append(0)
    #df={}
    lf=[[float("inf") for _ in range(W+2)] for _ in range(H+2)]#
    #これでfとdの両方の役割をこなす
    lf[1][1]=0
    while q:
        tmpij=q.popleft()
        #tmpd=qd.popleft()
        #df[tmpij]=1
        if tmpij==(H,W):
            break
        lind=[(-1,0),(1,0),(0,-1),(0,1)]#
        for i in range(4):
            #ntmpij=(tmpij[0]+(i<2)*(2*i-1),tmpij[1]+(i>1)*(2*i-5))
            ntmpij=(tmpij[0]+lind[i][0],tmpij[1]+lind[i][1])
            #print(ntmpij)
            #if ntmpij not in df and ls[ntmpij[0]][ntmpij[1]]==".":
            if lf[ntmpij[0]][ntmpij[1]]==float("inf") and ls[ntmpij[0]][ntmpij[1]]==".":
                #c_tmp=ctmp(ntmpij,tmp.dis+1)
                #q.append(c_tmp)
                q.append(ntmpij)
                #qd.append(tmpd+1)
                lf[ntmpij[0]][ntmpij[1]]=lf[tmpij[0]][tmpij[1]]+1
                #dは訪れる前に書き込んでしまう
    if tmpij==(H,W):
        nw=0
        for i in range(1,H+1):
            #for j in range(1,W+1):
             #   if ls[i][j]==".":
              #      nw+=1
            nw+=ls[i].count(".")
        #print(nw-tmpd-1)
        print(nw-lf[H][W]-1)
    else:
        print(-1)

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

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

a = 0
for i in range(n+1):
  c = 0
  for j in range(n-i-1):
    if h[i:][j] >= h[i:][j+1]:
      c += 1
    else:
      break
  if c > a:
    a = c
        
print(a)
    

### FIXED CODE ###

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

c = 0
a = 0   
for i in range(n-1):
  if h[i] >= h[i+1]:
    c += 1
  else:
    a = max(c, a)
    c = 0
    
#最後のcはelseで引っかからない
a = max(c, a)    
        
print(a)
### BUGGY CODE ###

def main():
    N = int(input())
    S = list(str(input()))
    print()
    sum = 0
    for i in range(0, N-2):
        si = S[i]
        for j in range(i, N-1):
            sj = S[j]
            for k in range(j, N):
                sk = S[k]
                #if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                if j - i != k -j:
                    if si != sj and si != sk and sj != sk:
                    #if j - i != k -j:
                        sum += 1
    print(sum)



main()

### FIXED CODE ###

def main():
    N = int(input())
    S = list(str(input()))
    sum = S.count("R") * S.count("G") * S.count("B")
    for i in range(0, N-2):
        si = S[i]
        for j in range(i+1, N-1):
            sj = S[j]
            k = 2*j -i  # Nを超える
            if k < N:
                sk = S[k]
                #if j - i != k -j and si != sj and si != sk and sj != sk:
                if si != sj and si != sk and sj != sk:
                    sum -= 1
    print(sum)

    # 提出 #11871188


main()
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
AA=list(set(A))
ans=0
for a in AA:
    aa=A.count(a)
    if aa>=a:
        ans+=aa-a
    else:
        ans+=aa
print(ans)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
A.sort()
A+=[10**9+1]
ans,memo,counter=0,0,0
for a in A:
    if a!=memo:
        if memo>counter:ans+=counter
        memo,counter=a,0
    counter+=1
    if counter>memo:ans+=1
print(ans)
### BUGGY CODE ###

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

L.sort()
result = 0
for i in range(N - 2):
  for j in range(i + 1, N - 1):
    a = L[i]
    b = L[j]
    for k in range(j + 1, N):
      c = L[k]
      if c >= a + b:
        break
      if a < b + c and b < c + a:
        result += 1
print(result)


### FIXED CODE ###

from bisect import bisect_left, bisect_right

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

L.sort()
result = 0
for i in range(N - 2):
  a = L[i]
  for j in range(i + 1, N - 1):
    b = L[j]
    result += bisect_left(L, a + b) - j - 1
print(result)