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

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def main():
    n, a, b = map(int, input().split())
    whole = 2**n-1
    a = cmb(n, a)
    b = cmb(n, b)
    print((whole-a-b)%(10**9+7))

if __name__ == "__main__":
    main()

### FIXED CODE ###

mod = 10**9+7 
n, a, b = map(int, input().split())
whole = pow(2, n, mod)-1 # 2^n-1(mod p)を計算。
# nCaの計算
comb1=1
for i in range(n-a+1,n+1): # n*(n-1)*(n-2)*...*(n-a+1)(mod p)を計算
  comb1 *= i
  comb1 %= mod
for i in range(1,a+1): # 1/a!(mod p)を計算 フェルマーの小定理:1/a = a^p-2(mod p)を利用
  comb1 *= pow(i,mod-2,mod)
  comb1 %= mod
comb2=1
for i in range(n-b+1,n+1): # n*(n-1)*(n-2)*...*(n-b+1)(mod p)を計算
  comb2 *= i
  comb2 %= mod
for i in range(1,b+1):
  comb2 *= pow(i,mod-2,mod)
  comb2 %= mod
whole -= (comb1+comb2)
whole %= mod
print(whole)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import random
random.seed(0)

D = int(input())
C = list(map(int, input().split()))
list_S = [list(map(int, input().split())) for _ in range(D)]

answer = []

def manzoku(A):
  score = 0
  L = [0 for _ in range(26)]
  for i in range(D):
    S = list_S[i]
    contest_index = A[i]
    for j in range(26):
      if j==contest_index:
        L[j] = 0
        score += S[j]
      else:
        L[j] += C[j]
        score -= L[j] 
  return score

L = [0 for _ in range(26)]
for S in list_S:
  contest_index = -1
  contest_manzoku = -10**9
  for i in range(26):
    i_manzoku = S[i]+C[i]+L[i]
    if i_manzoku > contest_manzoku:
      contest_index = i
      contest_manzoku = i_manzoku
  answer.append(contest_index)
  for i in range(26):
    if i==contest_index:
      L[i] = 0
    else:
      L[i] += C[i]

manzoku_now = manzoku(answer)

answer_tmp = [answer[i] for i in range(D)]
for _ in range(10000):
  day = random.randrange(D)
  contest = random.randrange(26)
  answer_tmp = [answer[i] for i in range(D)]
  answer_tmp[day] = contest
  if manzoku_now < manzoku(answer_tmp):
    answer[day] = contest
  else:
    answer_tmp[day] = answer[day]

print(manzoku(answer))
for index in answer:
  print(index+1)

### FIXED CODE ###

# -*- coding: utf-8 -*-

D = int(input())
C = list(map(int, input().split()))
L = [0 for _ in range(26)]

for _ in range(1,D+1):
  S = list(map(int, input().split()))
  contest_index = -1
  contest_manzoku = -10**9
  for i in range(26):
    i_manzoku = S[i]+C[i]+L[i]
    if i_manzoku > contest_manzoku:
      contest_index = i
      contest_manzoku = i_manzoku
  print(contest_index+1)
  for i in range(26):
    if i==contest_index:
      L[i] = 0
    else:
      L[i] += C[i]
### BUGGY CODE ###

import math

MAXN = 100001
isPrime = [True for x in range(0, MAXN)]

def findPrime():
    isPrime[1] = False
    for i in range(2, MAXN):
        if isPrime[i]:
            for j in range(i + i, int(math.sqrt(MAXN)) + 1, i):
                isPrime[j] = False

findPrime()

Q = int(input())

for i in range(Q):
    temp = 0
    l, r = map(int, input().split())
    for j in range(l, r + 1, 2):
        if isPrime[j] and isPrime[(j+1)//2]:
            temp += 1
    print(temp)




### FIXED CODE ###

MAXN = 100001
isPrime = [True for x in range(0, MAXN)]

def findPrime():
    isPrime[1] = False
    for i in range(2, MAXN):
        if isPrime[i]:
            for j in range(i + i, MAXN, i):
                isPrime[j] = False

findPrime()

cache = [0 for x in range(0, MAXN)]

pSum = 0
for i in range(1, MAXN, 2):
    cache[i] = pSum
    if isPrime[i] and isPrime[(i+1)//2]:
        cache[i] += 1
    pSum = cache[i]

Q = int(input())

for i in range(Q):
    l, r = map(int, input().split())
    print(cache[r] - cache[l - 2])
### BUGGY CODE ###


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

ans = 0
for i in range(n):
    tmp1 = a[i]
    for j in range(i+1, n):
        tmp2 = a[j]
        if tmp1 & tmp2 == 0:
            ans += 1
            # print(tmp1, tmp2)
            tmp1 = tmp1 ^ tmp2
        else:
            break
print(ans + n)

### FIXED CODE ###

#!/usr/bin/env python3

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

total = a[0]
xor = a[0]
ans = 0
l = 0
r = 0

while 1:
    if xor == total:
        ans += r-l+1
        r += 1
        if r == n:
            break
        total += a[r]
        xor ^= a[r]
    else:
        total -= a[l]
        xor ^= a[l]
        l += 1
print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
b=[]
for i in range(n):
    b.append(a[i])
    b=b[::-1]
print(*b)

### FIXED CODE ###

n=int(input())
a=input().split()
b=" ".join(a[-1::-2] + a[(n%2)::2])
print(b)
### BUGGY CODE ###

#16:07
n = int(input())
raw = []
for _ in range(n):
  raw.append(list(map(lambda x: int(x)-1, input().split())))
cnt = [0 for _ in range(n)]
now = [i for i in range(n)]
ans = 0
while now:
  ans += 1
  last = now
  now = []
  tmp = [0 for _ in range(n)]
  for x in last:
    try:
      y = raw[x][cnt[x]]
      if tmp[x] == tmp[y] == 0 and x == raw[y][cnt[y]]:
        cnt[x] += 1
        cnt[y] += 1
        tmp[x] = 1
        tmp[y] = 1
        now.append(x)
        now.append(y)
    except:
      pass
  #print(now)
if cnt == [n-1 for _ in range(n)]:
  print(ans-1)
else:
  print(-1)

### FIXED CODE ###

#7271131(wotsushi)解答
n = int(input())
a = []
for _ in range(n):
  a.append(list(map(lambda x: int(x)-1, input().split())))
cnt = [0 for _ in range(n)]
now = []
for i in range(n):
  j = a[i][cnt[i]]
  if a[j][cnt[j]] == i and i < j:
    now.append([i,j])
ans = 0
while now:
  #print(now)
  last = now
  now = []
  for x in last:
    i = x[0]
    j = x[1]
    cnt[i] += 1
    cnt[j] += 1
    if cnt[i] < n-1:
      k = a[i][cnt[i]]
      if a[k][cnt[k]] == i:
        now.append([i,k])
    if cnt[j] < n-1:
      k = a[j][cnt[j]]
      if a[k][cnt[k]] == j:
        now.append([j,k])
  ans += 1
if all(cnt[i] == n-1 for i in range(n)):
  print(ans)
else:
  print(-1)
### BUGGY CODE ###

import sys
import numpy as np
from scipy.sparse.csgraph import bellman_ford
from scipy.sparse import csr_matrix
from collections import deque
input = sys.stdin.readline


def main():
    n, m, p = map(int, input().split())
    
    inf = 10**9
    l = np.zeros((n, n))
    tree_forth = [[] for _ in range(n)]
    tree_back = [[] for _ in range(n)]
    for i in range(m):
        a, b, c =map(int, input().split())
        tree_forth[a-1].append(b-1)
        tree_back[b-1].append(a-1)
        c = p-c
        if c == 0:
            c = 10**(-8)
        if l[a-1][b-1] == 0:
            l[a-1][b-1] = c
        else:
            l[a-1][b-1] = min(l[a-1][b-1], c)
    
    already1, already2 = [True]*n, [True]*n
    for already, tree, start in zip([already1, already2], [tree_forth, tree_back], [0, n-1]):
        not_yet = deque([start])
        already[start] = False
        while not_yet:
            key = not_yet.pop()
            for v in tree[key]:
                if already[v] == False:
                    continue
                already[v] = False
                not_yet.append(v)
    
    for i in range(n):
        if already1[i] or already2[i]:
            for j in range(n):
                l[i][j] = 0
                l[j][i] = 0
            
    
    try:
        print(max(0, int(bellman_ford(csr_matrix(l))[0][-1])*(-1)))
    except:
        print(-1)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
import numpy as np
from scipy.sparse.csgraph import bellman_ford, connected_components
input = sys.stdin.readline


def main():
    n, m, p = map(int, input().split())
    
    l = np.zeros((n, n))
    for i in range(m):
        a, b, c =map(int, input().split())
        c = p-c
        if c == 0:
            c = 10**(-7.9)
        if l[a-1][b-1] == 0:
            l[a-1][b-1] = c
        else:
            l[a-1][b-1] = min(l[a-1][b-1], c)
    x = l[-1, 0]
    l[-1][0] = 10**(-7.9)
    n, labels = connected_components(l, connection="strong")
    l = l[labels == labels[0]][:, labels == labels[0]]
    l[-1, 0] = x
    
    try:
        print(max(0, int(round(bellman_ford(l, indices=0)[-1]))*(-1)))
    except:
        print(-1)


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

def warshall_floyd(d):
    for k in range(len(d)):
        for i in range(len(d)):
            for j in range(len(d)):
                if d[i][j] > d[i][k] + d[k][j]:
                    d[i][j] = d[i][k] + d[k][j]

import sys
f = sys.stdin

while True:
    n, m = map(int, f.readline().split())
    if n == 0:
        break
    abct = [list(map(int, f.readline().split())) for _ in range(n)]
    
    d = [[[float('inf')] * m for i in range(m)], [[float('inf')] * m for i in range(m)]]
    
    for ai, bi, ci, ti in abct:
        d[0][ai - 1][bi - 1] = d[0][bi - 1][ai - 1] = ci
        d[1][ai - 1][bi - 1] = d[1][bi - 1][ai - 1] = ti

    warshall_floyd(d[0])
    warshall_floyd(d[1])
        
    for i in range(int(f.readline())):
        p, q, r = map(int, f.readline().split())
        print(d[r][p - 1][q - 1])

### FIXED CODE ###

import heapq
import sys
from collections import defaultdict

def dijkstra(graph, size, start):
    d = [float('inf')] * size
    d[start] = 0
    q = [(0, start)]
    while len(q):
        du, u = heapq.heappop(q)
        for length, v in graph[u]:
            if d[v] > du + length:
                d[v] = du + length
                heapq.heappush(q, (d[v], v))
    return d

f = sys.stdin

while True:
    n, m = map(int, f.readline().split())
    if n == 0:
        break
    abct = [map(int, f.readline().split()) for _ in range(n)]
    d = [defaultdict(list), defaultdict(list)]
    
    for ai, bi, ci, ti in abct:
        ai -= 1
        bi -= 1
        d[0][ai].append((ci, bi))
        d[0][bi].append((ci, ai))
        d[1][ai].append((ti, bi))
        d[1][bi].append((ti, ai))
    
    dist = {}
    for i in range(int(f.readline())):
        p, q, r = map(int, f.readline().split())
        p -= 1
        q -= 1
        try:
            print(dist[(q,r)][p])
        except KeyError:
            try:
                print(dist[(p,r)][q])
            except:
                dist[(p,r)] = dijkstra(d[r], m, p)
                print(dist[(p,r)][q])
### BUGGY CODE ###

import math
n,a,b = map(int,input().split())
if n == 2 :
    print(0)
else:
    ans = 1
    for i in range(n):
        ans = (ans*2)% (10**9+7)
    ans = ans-1
    numa = 1
    for i in range(1,a+1):
        numa = (numa *(n - i + 1) // i)%(10**9+7)
    numb = numa
    for i in range(a+1,b+1):
        numb = (numb * (n - i + 1) //i)%(10**9+7)
    ans = (ans -(numa+numb))%(10**9+7)
    print(ans%(10**9+7))

### FIXED CODE ###

#TRE
#pow(m,n)のnが大きい時は繰り返し2乗法を使う

#繰り返し2乗法のアルゴリズム
def modPow (a,n,p):
    if n==1:
        return a % p
    if n%2 == 1:
        return (a * modPow(a,n-1,p)) % p
    else:
        t = modPow(a,n/2,p)
        return t * t


#main
n,a,b = map(int,input().split())
p = 10**9+7
if n == 2 :
    print(0)
else:
#繰り返し2乗法により計算時間を短縮
    ans = modPow(2,n,p)-1#組み合わせのシグマは2のn乗
#組み合わせはn*...*(n-a+1)/(a*...*1)
    child_a = 1
    mother_a = 1
    for i in range(a):
        child_a = (child_a*(n-i))%p
        mother_a = (mother_a*(i+1))%p
    com_a = (child_a * modPow(mother_a,p-2,p)) % p
    child_b = 1
    mother_b = 1
    for i in range(b):
        child_b = (child_b*(n-i))%p
        mother_b = (mother_b*(i+1))%p
    com_b = (child_b * modPow(mother_b,p-2,p)) % p
    ans = (ans -(com_a+com_b))%p
    print(ans%p)
### BUGGY CODE ###

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

from itertools import combinations
a = list(combinations(l, n-1))
#print(a)

from fractions import gcd
from functools import reduce

def gcd_list(numbers):
    return reduce(gcd, numbers)

g = []
for i in range(len(a)):
    g.append(gcd_list(a[i]))

print(max(g))

### FIXED CODE ###

n = int(input())
l = list(map(int, input().split()))
#print(l)
l2 = list(reversed(l))
#print(l2)
#from itertools import combinations
#a = list(combinations(l, n-1))
#print(a)
from fractions import gcd
L, R = [0], [0]
for i in range(n):
    L.append(gcd(L[i],l[i]))
    R.append(gcd(R[i],l2[i]))
#print(L)
R = list(reversed(R))
#print(R)
g = []
for j in range(n):
    g.append(gcd(L[j],R[j+1]))
print(max(g))


#from functools import reduce

#def gcd_list(numbers):
#    return reduce(gcd, numbers)
### BUGGY CODE ###

N = int(input())
l = []
for i in range(N):
    word = input()
    if not word in l:
        l.append(word)

print(len(l))


### FIXED CODE ###

N = int(input())
l = []
for i in range(N):
    l.append(input())
l = sorted(l)
new_list = []
new_list.append(l[0])
for i in range(1,len(l)):
    if l[i-1] != l[i]:
        new_list.append(l[i])
print(len(new_list))
### BUGGY CODE ###

N = input()
N = int(N)

for i in range(1,1000000000):
    if i%2 == 0 and i%N == 0:
        number = i
        print(number)
        break

### FIXED CODE ###

N = input()
N = int(N)

if N%2 == 0:
    print(N)
else:
    N = N*2
    print(N)
### BUGGY CODE ###

def Eratosthenes(n):
	N = [1 for i in range(0,n+1)]
	i = 3
	while i*i<=n:
		if N[i]:
			j = i*3
			while j<=n:
				N[j] = 0
				j += i*2
		i += 2
	return N

while True:
	N = Eratosthenes(999999)
	try:
		n = int(input())
	except EOFError:
		break
	cnt = 0
	if n>=2:
		cnt = 1
	for i in range(3, n+1, 2):
		cnt += N[i]
	print(cnt)

### FIXED CODE ###

def Eratosthenes(n):
	N = [1 for i in range(0,n+1)]
	i = 3
	while i*i<=n:
		if N[i]:
			j = i*i
			while j<=n:
				N[j] = 0
				j += i*2
		i += 2
	return N

N = Eratosthenes(999999)
while True:
	try:
		n = int(input())
	except EOFError:
		break
	cnt = 0
	if n>=2:
		cnt = 1
	for i in range(3, n+1, 2):
		cnt += N[i]
	print(cnt)
### BUGGY CODE ###

def gcd(x, y):
    if y == 0 :
        return x
    else:
        return gcd(y,x%y)
def prime(x):
    if x == 1 :
        return False
    else:
        for i in range(2,int(x**(0.5))+1):
            if x % i == 0 :
                return False
        return True

A,B = map(int,input().split())
t = gcd(A,B)
ans = 1
for i in range(2,t+1):
    if prime(i) and t % i == 0 :
        ans += 1
    else:
        pass

print(ans)


### FIXED CODE ###

def gcd(x, y):
    if y == 0 :
        return x
    else:
        return gcd(y,x%y)
def prime(x):
    global  ans
    m = x ** (0.5)
    for i in range(2,int(m+1)):
        if x % i == 0 :
            while True:
                if x % i != 0 :
                    break
                else:
                    x = (x//i)
            ans +=1
    if x != 1 :
        ans += 1
    return ans
A,B = map(int,input().split())
t = gcd(A,B)
ans = 1
print(prime(t))
### BUGGY CODE ###

n = int(input())

a = [int(input()) for _ in range(n)]
[print(max(a[:i] + a[i+1:])) for i in range(n)]


### FIXED CODE ###

import heapq

n = int(input())
a = [int(input()) for _ in range(n)]
a1, a2 = heapq.nlargest(2, a)
[print(a1) if _ != a1 else print(a2) for _ in a]
### BUGGY CODE ###

s=input()
t=input()
Ns=len(s)
Nt=len(t)
dp=[["" for i in range(Nt+1)]for j in range(Ns+1)]
for i in range(1,Ns+1):
    for j in range(1,Nt+1):
        if s[i-1]==t[j-1]:
            dp[i][j]=dp[i-1][j-1]+s[i-1]
        else:
            if len(dp[i][j-1])>len(dp[i-1][j]):
                dp[i][j]=dp[i][j-1]
            else:
                dp[i][j]=dp[i-1][j]
print(dp[Ns][Nt])

### FIXED CODE ###

S=input()
T=input()
dp=[[0 for j in range(len(T)+1)] for i in range(len(S)+1)]
for i in range(len(S)):
    for j in range(len(T)):
        if S[i]==T[j]:
            dp[i+1][j+1]=dp[i][j]+1
        dp[i+1][j+1]=max(dp[i+1][j+1],dp[i+1][j])
        dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j+1])
i=len(S)
j=len(T)
ans=""
while i>0 and j>0:
    if dp[i][j]==dp[i-1][j]:
        i-=1
    elif dp[i][j]==dp[i][j-1]:
        j-=1
    else:
        ans=S[i-1]+ans
        i-=1
        j-=1
print(ans)
### BUGGY CODE ###

from numpy import cumsum 
n, m, q = list(map(int, input().split()))
lst = [[0]*n for i in range(n)]
for i in range(m):
    l, r = list(map(lambda x: int(x)-1, input().split()))
    lst[l][r] += 1
newlst = cumsum(lst, axis=1)
pq = list(list(map(lambda x: int(x)-1, input().split())) for i in range(q))
for a, b in pq:
    ans = sum([newlst[i][b] for i in range(a, b+1)])
    print(ans)

### FIXED CODE ###

from numpy import cumsum 
n, m, q = list(map(int, input().split()))
lst = [[0]*(n+1) for i in range(n+1)]
for i in range(m):
    l, r = list(map(int, input().split()))
    lst[l][r] += 1
ans1 = cumsum(lst, axis=1)
ans = cumsum(ans1, axis=0)
for i in range(q):
    a, b = list(map(int, input().split()))
    print(ans[b, b] - ans[a-1, b])
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()
from math import factorial
from bisect import bisect
from functools import reduce

def func(x, arr):
    p = bisect(arr, x)
    num = 1
    for i in range(p + 1, len(arr) + 1):
        num = (num * i) % MOD
    arr = arr[:p]
    if len(arr) == 0:
        return x * num
    ret = 0
    for i in range(len(arr)):
        ret = (ret + func(x % arr[i], arr[:i] + arr[i + 1:])) % MOD
    return ret * num % MOD

def main():
    N, X = LI()
    S = LI()
    S.sort()
    ans = func(X, S)

    return ans

print(main())

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()
from math import factorial
from collections import Counter

def main():
    N, X = LI()
    S = LI()
    S.sort(reverse=True)
    dp = Counter()
    dp[X] = factorial(N)
    for i, s in enumerate(S):
        pre = dp
        dp = Counter()
        for n, cnt in pre.items():
            if s <= n:
                dp[n] += cnt * (N - 1 - i) // (N - i)
                dp[n % s] += cnt // (N - i)
            else:
                dp[n] += cnt
    ans = 0
    for n, cnt in dp.items():
        ans = (ans + (n * cnt) % MOD) % MOD

    return ans

print(main())
### BUGGY CODE ###

from collections import deque
h,w=map(int,input().split())
ch,cw=map(int,input().split())
dh,dw=map(int,input().split())

maze = [list(input()) for i in range(h)]
ans = [[-1]*w for i in range(h)]

dx=[0,1,0,-1]
dy=[1,0,-1,0]

ans[ch-1][cw-1]=0
def bfs(ans):
  qu = deque([])
  qu.append([cw-1,ch-1])
  while qu:
    zahyou=qu.popleft()
    x=zahyou[0]
    y=zahyou[1]
    count=0
    for i in range(4):
      if 0 <= x+dx[i] < w and 0 <= y+dy[i] < h:
        if maze[y+dy[i]][x+dx[i]]=="." and (ans[y+dy[i]][x+dx[i]]>ans[y][x] or ans[y+dy[i]][x+dx[i]]==-1):
          qu.append([x+dx[i],y+dy[i]])
          ans[y+dy[i]][x+dx[i]] = ans[y][x]
          count+=1
    if count<3:
      for i in range(x-2,x+3):
        for j in range(y-2,y+3):
          if 0<=i<w and 0<=j<h:
            if maze[j][i]=="." and (ans[j][i]>ans[y][x]+1 or ans[j][i]==-1):
              ans[j][i]=(ans[y][x]+1)
              qu.append([i,j])

bfs(ans)
print(ans[dh-1][dw-1])
  



### FIXED CODE ###

from collections import deque
h,w=map(int,input().split())
ch,cw=map(int,input().split())
dh,dw=map(int,input().split())

maze = [list(input()) for i in range(h)]
ans = [[-1]*w for i in range(h)]

dx=[0,1,0,-1]
dy=[1,0,-1,0]

ans[ch-1][cw-1]=0
def bfs(ans):
  qu = deque([])
  qu.append([cw-1,ch-1])
  while qu:
    zahyou=qu.popleft()
    x=zahyou[0]
    y=zahyou[1]
    count=0
    for i in range(4):
      if 0 <= x+dx[i] < w and 0 <= y+dy[i] < h:
        if maze[y+dy[i]][x+dx[i]]=="." and (ans[y+dy[i]][x+dx[i]]>ans[y][x] or ans[y+dy[i]][x+dx[i]]==-1):
          qu.appendleft([x+dx[i],y+dy[i]])
          ans[y+dy[i]][x+dx[i]] = ans[y][x]
          count+=1
    if count!=4:
      for i in range(x-2,x+3):
        for j in range(y-2,y+3):
          if 0<=i<w and 0<=j<h:
            if maze[j][i]=="." and (ans[j][i]>ans[y][x]+1 or ans[j][i]==-1):
              ans[j][i]=(ans[y][x]+1)
              qu.append([i,j])

bfs(ans)
print(ans[dh-1][dw-1])
### BUGGY CODE ###

n = int(input())
s = input()
r = [False]*n
g = [False]*n
b = [False]*n
for i in range(len((s))):
    if s[i] == 'R':
        r[i] = True
    elif s[i] == 'G':
        g[i] = True
    else:
        b[i] = True
count = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if r[i] and g[j] and b[k] and j - i != k - j:
                count += 1
            if r[i] and g[k] and b[j] and j - i != k - j:
                count += 1
            if r[j] and g[i] and b[k] and j - i != k - j:
                count += 1
            if r[j] and g[k] and b[i] and j - i != k - j:
                count += 1
            if r[k] and g[i] and b[j] and j - i != k - j:
                count += 1
            if r[k] and g[j] and b[i] and j - i != k - j:
                count += 1
print(count)


### FIXED CODE ###

# https://atcoder.jp/contests/abc162/submissions/11837869
# tamazooさんを参考に書いた
n = int(input())
s = input()
x = [0] * n
num_r, num_g, num_b = 0, 0, 0
for i in range(n):
    if s[i] == 'R':
        x[i] = 1
        num_r += 1
    elif s[i] == 'G':
        x[i] = 2
        num_g += 1
    elif s[i] == 'B':
        x[i] = 4
        num_b += 1

num = num_r * num_g * num_b

for i in range(n):
    for j in range(1, n):
        if i - j < 0 or n <= i + j:
            break
        else:
            if (x[i - j] + x[i] + x[i + j]) == 7:
                num -= 1
print(num)
### BUGGY CODE ###

from scipy.special import comb
from collections import Counter

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

count = Counter(A)
combs, all = {}, 0
for k in count.keys():
    c = comb(count[k], 2)
    combs[k] = c
    all += c

for a in A:
    ans = all - combs[a] + comb(count[a]-1,2)
    print(int(ans))


### FIXED CODE ###

from scipy.special import comb
from collections import Counter

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

count = Counter(A)
combs = {k:comb(count[k], 2) for k in count.keys()}
combs_minas_one = {k:comb(count[k]-1, 2) for k in count.keys()}
all = sum(combs.values())

for a in A:
    ans = all - combs[a] + combs_minas_one[a]
    print(int(ans))
### BUGGY CODE ###

n, q = [int(el) for el in input().split(' ')]
data = [0] * n
for _ in range(q):
    a, v = [int(el) for el in input().split(' ')]
    data[a-1] += v
    result = max(data)
    print(data.index(result)+1, result)

### FIXED CODE ###

n, q = [int(el) for el in input().split(' ')]
data = [0] * n
result, index = 0, 1
for _ in range(q):
    a, v = [int(el) for el in input().split(' ')]
    data[a-1] += v
    if v > 0:
        if result < data[a-1]:
            result, index = data[a-1], a
        elif result == data[a-1]:
            index = min(index, a)
    else:
        if index == a:
            result = max(data)
            index = data.index(result) + 1
    print(index, result)
### BUGGY CODE ###

N = int(input())
S = list(map(str,input()))

R = []
G = []
B = []
for i in range(N):
    if S[i] == "R":
        R.append(i)
    elif S[i] == "G":
        G.append(i)
    else:
        B.append(i)
ans = 0
for i in range(len(R)):
    for j in range(len(G)):
        for k in range(len(B)):
            kumi = sorted([R[i],G[j],B[k]])
            if not kumi[1] - kumi[0] == kumi[2] - kumi[1]:
                ans += 1

print(ans)


### FIXED CODE ###

N = int(input())
S = list(map(str,input()))

r = 0
g = 0
b = 0
for i in range(N):
    if S[i] == "R":
        r+=1
    elif S[i] == "G":
        g+=1
    else:
        b+=1
ans = 0
for i in range(N):
    for j in range(1,N//2+2):
        if i+2*j < N:
            if S[i] != S[i+j] and S[i] != S[i+2*j] and S[i+j] != S[i+2*j]:
                ans +=1

print(r*g*b-ans)