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

n = int(input())
s = input()
ans = []
for i in range(n):
    ans.append(s[:i].count('W') + s[i+1:].count('E'))
print(min(ans))

### FIXED CODE ###

n = int(input())
s = input()
ans = [s[1:n].count("E")]
for i in range(1, n):
    #ans.append(s[:i].count('W') + s[i+1:].count('E'))
    ans.append(ans[i-1]-int(s[i] is "E")+int(s[i-1] is "W"))
print(min(ans))
### BUGGY CODE ###

n=int(input())
p=list(map(int, input().split()))
count=1
if not n==1:
  for i in range(1, n):
    for j in range(i):
      if not p[i] <= p[j]:
        break
      elif j==i-1:
        count+=1
  print(count)
else:
  print(1)

### FIXED CODE ###

n=int(input())
p=list(map(int, input().split()))
min=200000
count=0
for i in range(n):
  if p[i] <= min:
    min=p[i]
    count+=1
print(count)
### BUGGY CODE ###

_in = list(open(0))
h, w = list(map(int, _in[0].split()))

s = []
for i, y in enumerate(_in[1:]):
    for j, x in enumerate(y):
        if x == '#':
            s.append((i+1,j+1))

a = [[False]*(w+2)]
a += [[False] + [True]*w + [False] for _ in range(h)]
a += [[False]*(w+2)]

ans = -1
while s:
    ns = []
    for i, j in s:
        a[i][j] = False

        if a[i-1][j]:
            a[i-1][j] = False
            ns.append((i-1, j))
        if a[i+1][j]:
            a[i+1][j] = False
            ns.append((i+1, j))
        if a[i][j-1]:
            a[i][j-1] = False
            ns.append((i, j-1))
        if a[i][j+1]:
            a[i][j+1] = False
            ns.append((i, j+1))
        
    s = ns
    ans += 1
    
print(ans)

### FIXED CODE ###

def main():
    H, W = map(int, input().split())
    m = []
    m.append([True] * (W + 2))
    for _ in range(H):
        m.append([True] + [c == '#' for c in input()] + [True])
    m.append([True] * (W + 2))
    queue = []
    for i in range(1, H + 1):
        for j in range(1, W + 1):
            if m[i][j]:
                queue.append((i, j))
    ans = -1
    while queue:
        ans += 1
        tmp = []
        for x, y in queue:
            if not m[x - 1][y]:
                m[x - 1][y] = True
                tmp.append((x - 1, y))
            if not m[x + 1][y]:
                m[x + 1][y] = True
                tmp.append((x + 1, y))
            if not m[x][y - 1]:
                m[x][y - 1] = True
                tmp.append((x, y - 1))
            if not m[x][y + 1]:
                m[x][y + 1] = True
                tmp.append((x, y + 1))
        queue = tmp
    print(ans)

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

import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)


n = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7

x = lcm(*A)
ans = sum([x//a for a in A]) % mod
print(ans)

### FIXED CODE ###

import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7

x = lcm(*A) % mod
ans = sum([x * pow(a, mod-2, mod) for a in A]) % mod
print(ans)
### BUGGY CODE ###

from operator import mul
from functools import reduce
N = int(input())
A = [int(i) for i in input().split()]
ans = reduce(mul, A)
print(ans if ans <= 10**18 else -1)

### FIXED CODE ###

N = int(input())
A = sorted([int(i) for i in input().split()])
ans = 1
for a in A:
    if a == 0:
        ans = 0
        break
    ans *= a
    if ans > 10**18:
        ans = -1
        break
print(ans)
### BUGGY CODE ###

n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[float("INF") for i in range(n)]
dp[0]=0
for i in range(1,n):
    for j in range(1,min(i,k)+1):
        dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
print(dp[n-1])

### FIXED CODE ###

import numpy as np
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n,k=IL()
h=np.array(IL())
dp=np.full(n,pow(10,6),dtype=int)
dp[0]=0
for i in range(1,n):
    t=i-min(i,k)
    dp[i]=np.min(dp[t:i]+abs(h[t:i]-h[i]))
print(dp[n-1])
### BUGGY CODE ###

from sys import stdin

def main():

    input = stdin.readline

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


    ans = 1

    for i in A:
        ans = ans * i
    
    if ans > 10 ** 18:
        print("-1")
    else:
        print(ans)


if __name__ == "__main__":
    main()

### FIXED CODE ###

from sys import stdin

def main():

    input = stdin.readline

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

    over_num = 10 ** 18

    ans = 1

    if A.count(0) > 0:
        print("0")
        return

    for i in A:
        ans = ans * i
        if ans > over_num:
            print("-1")
            return

    print(ans)


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

import collections
N = int(input())
A_list = list(map(int, input().split(" ")))
C_dic = collections.Counter(A_list)
ans_dic = {}
for i in A_list:
    if i in ans_dic:
        print(ans_dic[i])
    else:
        temp_sum = 0
        for j in C_dic:
            if i == j:
                temp = C_dic[j]-1
            else:
                temp = C_dic[j]
            temp = temp*(temp-1)//2
            temp_sum += temp

        ans_dic[i] = temp_sum
        print(temp_sum)

### FIXED CODE ###

import collections
N = int(input())
A_list = list(map(int, input().split(" ")))
C_dic = collections.Counter(A_list)
ans_dic = {}
sum_cdic = 0
temp_sum = 0
for i in C_dic:
    temp = C_dic[i]
    temp = temp*(temp-1)//2
    temp_sum += temp
sum_cdic = temp_sum

for i in A_list:
    if i in ans_dic:
        print(ans_dic[i])
    else:
        temp_sum = sum_cdic
        temp_sum -= (C_dic[i]*(C_dic[i]-1)//2)
        temp_sum += ((C_dic[i]-1)*(C_dic[i]-2)//2)
        ans_dic[i] = temp_sum
        print(temp_sum)
### BUGGY CODE ###

x=int(input())
c=1
for b in range(1,x):
  for p in range(2,x):
    if b**p<=x:c=max(c,b**p)
print(c)

### FIXED CODE ###

x=int(input())
c=1
for b in range(1,x):
    for p in range(2,x):
        if b**p<=x:c=max(c,b**p)
        else:break
print(c)
### BUGGY CODE ###

n = int(input())
ans = 0
for i in range(n):
    ans += i
print(ans)

### FIXED CODE ###

n = int(input())
print((n * (n - 1)) // 2)
### BUGGY CODE ###

import itertools
from sys import stdin
N=int(input())
st=list(stdin.readline().strip())
count=0
cnt=0
stt=set(st)
stt=list(stt)
num=["0","1","2","3","4","5","6","7","8","9"]
num = [s for s in num if s in stt ]
num_list= ["".join(i) for i in itertools.product(num,repeat=3)]

for number in num_list:
    for i in range(N):
        if number[cnt]==st[i]:
            cnt+=1
            if cnt==3:
                count += 1
                break
    cnt = 0
    
print(count)

### FIXED CODE ###

def main():
  N = int(input())
  S = list(map(int,input()))
  ans = 0
  for i in range(10):
    for j in range(10):
      for k in range(10):
        flg = False
        flg2 = False
        for x in range(N):
          if flg2:
            break
          if not flg:
            if S[x] == i:
              flg = True
          else:
            if S[x] == j:
              flg2 = True
              if k in S[x+1:]:
                ans +=1
  print(ans)
main()
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
    if  i % 2 == 1:
        b = b + [a[i]]
    else:
        b = [a[i]] + b
if n % 2 == 0:
    b.reverse()
print(' '.join(map(str,b)))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
b = []
c = []
for i in range(n):
    if  i % 2 == 1:
        b.append(a[i])
    else:
        c.append(a[i])
if n % 2 == 0:
    b.reverse()
    ans = b + c
else:
    c.reverse()
    ans = c + b
print(' '.join(map(str,ans)))
### BUGGY CODE ###

import sys
check=dict()
N,a,b,c,d=0,0,0,0,0
#ttfは235、chaはabc
def dfs_sub(n,ttf,cha):
    global check,d
    
    if 0 in check:
        check[0]=min(check[n]+n*d,check[0])
    else:
        check[0]=check[n]+n*d

    x1,x2=n//ttf,n%ttf
    if ttf-x2>=x2:
        if x1==0:
            if x1 in check:
                if check[x1]>check[n]+x2*d:
                    check[x1]=check[n]+x2*d
            else:
                check[x1]=check[n]+x2*d
        else:
            if x1 in check:
                if check[x1]>check[n]+x2*d+cha:
                    check[x1]=check[n]+x2*d+cha
                    dfs(x1)
            else:
                check[x1]=check[n]+x2*d+cha
                dfs(x1)

    x1,x2=n//ttf+1,ttf-n%ttf
    if ttf-x2>=x2:
        if x1 in check:
            if check[x1]>check[n]+x2*d+cha:
                check[x1]=check[n]+x2*d+cha
                dfs(x1)
        else:
            check[x1]=check[n]+x2*d+cha
            dfs(x1)


def dfs(n):
    global check,a,b,c,d
    dfs_sub(n,2,a)
    dfs_sub(n,3,b)
    dfs_sub(n,5,c)

t=int(input())
ans=[0]*t
for i in range(t):
    N,a,b,c,d=map(int,input().split())
    check={N:0}
    dfs(N)
    ans[i]=check[0]
for i in range(t):
    print(ans[i])

### FIXED CODE ###

import sys
check=dict()
N,a,b,c,d=0,0,0,0,0
#ttfは235、chaはabc
def dfs_sub(n,ttf,cha):
    global check,d
    if 0 in check:
        check[0]=min(check[n]+n*d,check[0])
    else:
        check[0]=check[n]+n*d
    if n//ttf==0:
        if n//ttf in check:
            if check[n//ttf]>check[n]+(n%ttf)*d:
                check[n//ttf]=check[n]+(n%ttf)*d
        else:
            check[n//ttf]=check[n]+(n%ttf)*d
    else:
        if n//ttf in check:
            if check[n//ttf]>check[n]+(n%ttf)*d+cha:
                check[n//ttf]=check[n]+(n%ttf)*d+cha
                dfs(n//ttf)
        else:
            check[n//ttf]=check[n]+(n%ttf)*d+cha
            dfs(n//ttf)
    if 1+n//ttf in check:
        if check[1+n//ttf]>check[n]+(ttf-n%ttf)*d+cha:
            check[1+n//ttf]=check[n]+(ttf-n%ttf)*d+cha
            dfs(1+n//ttf)
    else:
        check[1+n//ttf]=check[n]+(ttf-n%ttf)*d+cha
        dfs(1+n//ttf)


def dfs(n):
    global check,a,b,c,d
    dfs_sub(n,2,a)
    dfs_sub(n,3,b)
    dfs_sub(n,5,c)

t=int(input())
ans=[0]*t
for i in range(t):
    N,a,b,c,d=map(int,input().split())
    check={N:0}
    dfs(N)
    ans[i]=check[0]
for i in range(t):
    print(ans[i])
### BUGGY CODE ###

def gcd(x,y):
    a=max(x,y)
    b=min(x,y)
    if a%b==0:
        return b
    else:
        return gcd(a%b,b)
def lcm(x,y):
    return (x*y)//gcd(x,y)
N,M=map(int,input().split())
S=input()
T=input()
X=lcm(N,M)
U=["" for i in range(X)]
A=X//N
B=X//M
for i in range(N):
    U[i*A]=S[i]
for i in range(M):
    if U[i*B]!="" and U[i*B]!=T[i]:
        print(-1)
        exit()
    else:
        U[i*B]=T[i]
print(X)



### FIXED CODE ###

def gcd(x,y):
    a=max(x,y)
    b=min(x,y)
    if a%b==0:
        return b
    else:
        return gcd(a%b,b)
def lcm(x,y):
    return (x*y)//gcd(x,y)
N,M=map(int,input().split())
S=input()
T=input()
X=lcm(N,M)
Y=gcd(N,M)
A=N//Y
B=M//Y
for i in range(Y):
    if S[i*A]!=T[i*B]:
        print(-1)
        exit()
print(X)
### BUGGY CODE ###

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

def opA(D, v):
  ret = True
  if len(v) != 0:
    D.append(v.pop(0))
  else:
    ret = False
  return D, v, ret

def opB(D, v):
  ret = True
  if len(v) != 0:
    D.append(v.pop(-1))
  else:
    ret = False
  return D, v, ret

def opC(D, v):
  ret = True
  if len(D) != 0:
    v.insert(0, min(D))
    D.remove(min(D))
  else:
    ret = False
  return D, v, ret

def opD(D, v):
  ret = True
  if len(D) != 0:
    v.append(min(D))
    D.remove(min(D))
  else:
    ret = False
  return D, v, ret

def dp(n, D, v, op):
  if n == K:
    return sum(D)
  
  if op == 0:
    D, v, ret = opA(D, v)
  elif op == 1:
    D, v, ret = opB(D, v)
  elif op == 2:
    D, v, ret = opC(D, v)
  else:
    D, v, ret = opD(D, v)
  
  if ret == False:
    return sum(D)

  return max(dp(n + 1, D.copy(), v.copy(), 0), dp(n + 1, D.copy(), v.copy(), 1), dp(n + 1, D.copy(), v.copy(), 2), dp(n + 1, D.copy(), v.copy(), 3))

print(max(dp(0, [], V.copy(), 0), dp(0, [], V.copy(), 1), dp(0, [], V.copy(), 2), dp(0, [], V.copy(), 3)))

### FIXED CODE ###

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

R = min(N, K)
l = []
ans = 0
for a in range(R + 1):
  for b in range(R + 1 - a):
    l = V[:a] + V[N - b:]
    l.sort()
    for i in range(K - a - b + 1):
      ans = max(ans, sum(l[i:]))
print(max(ans, 0))
### BUGGY CODE ###

n,m,l=map(int,input().split())
#基本的にワーシャルフロイドの場合、行列式のリストで距離を保管する
d = [[10**20 for i in range(n+1)] for i in range(n+1)]
for i in range(m):
    x,y,z = map(int,input().split())
    #有向グラフか無向グラフかによってここで場合わけが生じる
    d[x][y] = z
    d[y][x] = z    
for i in range(n+1):
    d[i][i] = 0 #自身のところに行くコストは０
q=int(input())
que=[]
for _ in range(q):
    s,t=map(int,input().split())
    que.append((s,t))
for k in range(1,n+1):
    for i in range(1,n+1):
        for j in range(1,n+1):
            d[i][j] = min(d[i][j],d[i][k] + d[k][j])

e = [[10**20 for i in range(n+1)] for i in range(n+1)]

for i in range(1,n+1):
    for j in range(1,n+1):
        if d[i][j]<=l:
            e[i][j]=1
            
for i in range(n+1):
    e[i][i]=0  
for k in range(1,n+1):
    for i in range(1,n+1):
        for j in range(1,n+1):
            e[i][j] = min(e[i][j],e[i][k] + e[k][j])
for some in que:
    s,t=some[0],some[1]
    if e[s][t]<10**20:
        print(e[s][t]-1)
    else:
        print(-1)
    






### FIXED CODE ###

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

#基本的にワーシャルフロイドの場合、行列式のリストで距離を保管する
from scipy.sparse import csr_matrix
from scipy.sparse import csgraph 
d = [[10**12 for i in range(n+1)] for i in range(n+1)]
for i in range(m):
    x,y,z = map(int,input().split())
    #有向グラフか無向グラフかによってここで場合わけが生じる
    d[x][y] = z
    d[y][x] = z
    
for i in range(n+1):
    d[i][i] = 0 #自身のところに行くコストは０
q=int(input())
que=[]
for _ in range(q):
    s,t=map(int,input().split())
    que.append((s,t))
       
csr=csr_matrix(d)
K=csgraph.shortest_path(csr,method="FW",directed=True)
e = [[10**12 for i in range(n+1)] for i in range(n+1)]

for i in range(1,n+1):
    for j in range(1,n+1):
        if K[i][j]<=l:
            e[i][j]=1
            
for i in range(n+1):
    e[i][i]=0
    

A=csr_matrix(e)
ANS=csgraph.shortest_path(A,method="FW",directed=True)

for some in que:
    s,t=some[0],some[1]
    if int(ANS[s][t])<10**12:
        print(int(ANS[s][t])-1)
    else:
        print(-1)
### BUGGY CODE ###

class UnionFind:
  def __init__(self, n):
    self.parents = list(range(n))
    self.ranks = [0] * n

  def root(self, x):
    if self.parents[x] == x:
      return x
    else:
      y = self.root(self.parents[x])
      self.parents[x] = y
      return y

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

  def unite(self, x, y):
    x = self.root(x)
    y = self.root(y)
    if x == y:
      return
    if self.ranks[x] < self.ranks[y]:
      self.parents[x] = y
    else:
      self.parents[y] = x
      if self.ranks[x] == self.ranks[y]:
        self.ranks[x] += 1

n, m, k = map(int, input().split())
u = UnionFind(n)
allusers = {i for i in range(n)}
users = [set() for _ in range(n)]
for _ in range(m):
  a, b = map(int, input().split())
  users[a - 1].add(b - 1)
  users[b - 1].add(a - 1)
  u.unite(a - 1, b - 1)
for _ in range(k):
  a, b = map(int, input().split())
  users[a - 1].add(b - 1)
  users[b - 1].add(a - 1)

print(*[len([i for cand in allusers - users[i] if u.same(i, cand)]) - 1 for i in range(n)])


### FIXED CODE ###

from collections import defaultdict

class UnionFind:
  def __init__(self, n):
    self.parents = list(range(n))
    self.ranks = [0] * n

  def root(self, x):
    if self.parents[x] == x:
      return x
    else:
      y = self.root(self.parents[x])
      self.parents[x] = y
      return y

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

  def unite(self, x, y):
    x = self.root(x)
    y = self.root(y)
    if x == y:
      return
    if self.ranks[x] < self.ranks[y]:
      self.parents[x] = y
    else:
      self.parents[y] = x
      if self.ranks[x] == self.ranks[y]:
        self.ranks[x] += 1

n, m, k = map(int, input().split())
u = UnionFind(n)
counts = [1 for _ in range(n)]
for _ in range(m):
  a, b = map(int, input().split())
  u.unite(a - 1, b - 1)
  counts[a - 1] += 1
  counts[b - 1] += 1

for _ in range(k):
  a, b = map(int, input().split())
  if u.same(a - 1, b - 1):
    counts[a - 1] += 1
    counts[b - 1] += 1

groups = defaultdict(int)
for i in range(n):
  groups[u.root(i)] += 1

print(*[groups[u.root(i)] - counts[i] for i in range(n)])
### BUGGY CODE ###

import sys
input = sys.stdin.readline

L,R = map(int,input().split())
lst = []

if L <= 2019 and R >= 2019:
    print(0)
else:
    for i in range(L,R+1):
        if i % 2019 == 0:
            print(0)
            break
        for j in range(i+1,R+1):
            if j % 2019 == 0:
                print(0)
            lst.append((i*j)%2019)
    print(min(lst))


### FIXED CODE ###

import sys
input = sys.stdin.readline

L,R = map(int,input().split())
lst = []

if L <= 2019 and R >= 2019:
    print(0)
else:
    for i in range(L,R+1):
        if i % 2019 == 0:
            lst.append(0)
            break
        for j in range(i+1,R+1):
            if j % 2019 == 0:
                lst.append(0)
                break
            lst.append((i * j) % 2019)
        else:
            continue
        break
    print(min(lst))
### BUGGY CODE ###

from pprint import pprint
from collections import Counter
N, X, Y = map(int, input().split())

d = [[float("inf")]*N for i in range(N)] 
for i in range(N-1):
    d[i][i+1] = 1
    d[i+1][i] = 1

d[X-1][Y-1] = 1
d[Y-1][X-1] = 1

def warshall_floyd(d):
    for k in range(N):
        for i in range(N):
            for j in range(N):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

wf = warshall_floyd(d)
for i in range(N):
    wf[i][i] = 0

c = Counter()
for i in range(N):
    c.update(wf[i][:i])

for i in range(1, N):
    print(c[i])



### FIXED CODE ###

from collections import Counter

N, X, Y = map(int, input().split())
g = [[float("inf")] * N for _ in range(N)]

for i in range(1, N+1):
    for j in range(1, N+1):
        g[i-1][j-1] = min([abs(j-i), abs(X-i)+1+abs(Y-j), abs(Y-i)+1+abs(X-j)])

c = Counter()
for i in range(N):
    c.update(g[i][:i])

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

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

import collections

Ss_counted = collections.Counter(Ss)
max_val = max(Ss_counted.values())

# # https://note.nkmk.me/python-dict-value-max-min/

result = []
for k, v in Ss_counted.items():
    if v == max_val:
        result.append(k)

for i in range(len(result)):
    print(sorted(result)[i])
    


### FIXED CODE ###

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

import collections

Ss_counted = collections.Counter(Ss)
max_val = max(Ss_counted.values())

# # https://note.nkmk.me/python-dict-value-max-min/

result = []
for k, v in Ss_counted.items():
    if v == max_val:
        result.append(k)

result = sorted(result)
for i in range(len(result)):
    print(result[i])
### BUGGY CODE ###

n = int(input())
c=[]; s=[]; f=[]
for i in range(n-1):
    ci,si,fi = map(int,input().split())
    c.append(ci); s.append(si); f.append(fi)
for k in range(n-1):
    ans = [0]*(n)
    ans[k+1] = s[k] + c[k]
    for i in range(k+2,n):
        if ans[i-1] <= s[i-1]:
            ans[i] = s[i-1] + c[i-1]
        else:
            dpt = s[i-1]
            while ans[i-1] > dpt:
                dpt += f[i-1]
            ans[i] = dpt + c[i-1]
    print(ans[n-1])
print(0)


### FIXED CODE ###

n = int(input())
c=[]; s=[]; f=[]
for i in range(n-1):
    ci,si,fi = map(int,input().split())
    c.append(ci); s.append(si); f.append(fi)
for k in range(n-1):
    ans = [0]*(n)
    ans[k+1] = s[k] + c[k]
    for i in range(k+2,n):
        if ans[i-1] <= s[i-1]:
            ans[i] = s[i-1] + c[i-1]
        else:
            dpt = s[i-1]
            if (ans[i-1]-dpt)%f[i-1]==0:
                dpt = ans[i-1]
            else:
                dpt += ((ans[i-1]-dpt)//f[i-1]+1)*f[i-1]
            ans[i] = dpt + c[i-1]
    print(ans[n-1])
print(0)
### BUGGY CODE ###

n = int(input())
a = [int(i) for i in input().split()]
x = 1
for i in range(n):
    #print(a[i])
    x = x*a[i]
if x>1000000000000000000:
    print(-1)
else:
    print(x)

### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]
x = 1
f = 0
a.sort()
for i in range(n):
    #print(a[i])
    x = x*a[i]
    if x == 0:
        print(0)
        f = 1
        break
    elif x > 1000000000000000000:
        print(-1)
        f = 1
        break
if f == 0:
    print(x)
### BUGGY CODE ###

from collections import deque
import bisect
from math import sqrt
import sys
primes = deque([2, 3, 5, 7, 11, 13, 17, 19])
append = primes.append
for i in range(21, 1000000, 2):
    for j in range(3, int(sqrt(i))+1, 2):
        if i%j == 0:
            break
    else:
        append(i)

for l in sys.stdin:
    print(bisect.bisect(primes, int(l)))

### FIXED CODE ###

def get_prime_set(ub):
    from itertools import chain
    from math import sqrt

    if ub < 4:
        return ({}, {}, {2}, {2, 3})[ub]

    ub, ub_sqrt = ub+1, int(sqrt(ub))+1
    primes = {2, 3} | set(chain(range(5, ub, 6), range(7, ub, 6)))
    du = primes.difference_update
    for n in chain(range(5, ub_sqrt, 6), range(7, ub_sqrt, 6)):
        if n in primes:
            du(range(n*3, ub, n*2))

    return primes


import sys
from bisect import bisect_right
primes = list(get_prime_set(999999))
print(*(bisect_right(primes, int(n)) for n in sys.stdin), sep="\n")
### BUGGY CODE ###

from heapq import *
from collections import Counter
import itertools


n, x, y = map(int,input().split())
edges = [[] for _ in range(n)]

def dijkstra(s, edges):
    d = [float('inf')] * n
    d[s] = 0
    heap = [(0, s)]
    while heap:
        c, node = heappop(heap)
        for cost, v in edges[node]:
            if c + cost < d[v]:
                d[v] = c + cost
                heappush(heap, (d[v], v))
    return d

for i in range(n-1):
    u, v = i, i+1
    edges[u].append([1,v])
    edges[v].append([1,u])
edges[x-1].append([1, y-1])
edges[y-1].append([1, x-1])

ans = []

for s in range(n):
    ans.append(dijkstra(s, edges))

f_ans = []
for i in range(n):
    f_ans.append(ans[i][i+1:])
f_ans = Counter(list(itertools.chain.from_iterable(f_ans)))

for i in range(1, n):
    print(f_ans[i])

### FIXED CODE ###

n, x, y = map(int,input().split())
ls = [0] * n
for u in range(1, n):
    for v in range(u, n+1):
        u2x = abs(u-x)
        v2y = abs(v-y)

        d = min(v-u, u2x + 1 + v2y)
        ls[d] += 1

for k in range(1, n):
    print(ls[k])
### BUGGY CODE ###

from itertools import combinations

N = int(input())
name=[]
for i in range(N):
    si = input()
    if si[0] in ['M', 'A', 'R', 'C', 'H']:
        name.append(si)
if name==[]:
    print(0)
    exit()

ans=0
for i, names in enumerate(list(combinations(name, 3))):
    x,y,z=names[0][0],names[1][0],names[2][0]
    if x==y or y==z or z==x:
        continue
    else:
        ans+=1
print(ans)

### FIXED CODE ###

from itertools import combinations

N = int(input())
name=[]
m,a,r,c,h=0,0,0,0,0
for i in range(N):
    si = input()
    if si[0] in ['M', 'A', 'R', 'C', 'H']:
        name.append(si)
        if si[0]=='M':
            m+=1
        if si[0]=='A':
            a+=1
        if si[0]=='R':
            r+=1
        if si[0]=='C':
            c+=1
        if si[0]=='H':
            h+=1

if name==[]:
    print(0)
    exit()

names=dict({'m':m,'a':a,'r':r,'c':c,'h':h})
ans=0
for n in list(combinations(['m','a','r','c','h'],3)):
    ans += names[n[0]] * names[n[1]] * names[n[2]]
print(ans)