Harryxun/stf_run huggingface dataset:
terms = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(terms[K+1])


### FIXED CODE ###

terms = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(terms[K-1])
n,m=map(int,input().split();print("YNeos"[n>m::2])

### FIXED CODE ###

n,m=map(int,input().split());print("YNeos"[n>m::2])
n,m=map(int,input().split())
MOD = 10**9+7
ans=1
def inv_mod(a, p=MOD):
    def inv_mod_sub(a, p):
        if a == 1:
            return 1, 0
        else:
            d, r = p//a, p%a
            x, y = inv_mod_sub(r, a)
            return y-d*x, x
    if p < 0: p = -p
    a %= p
    return inv_mod_sub(a,p)[0] % p

def comb_mod(n, k):
    if k < 0 or k > n:
        return 0
    else:
        return f_mod[n]*f_mod_inverse[k]*f_mod_inverse[n-k] % MOD
f_mod=[1]*(m+1)
f_mod_inverse=[1]*(m+1)
for i in range(1,m+1):
  f_mod[i]=(f_mod[i-1]*i)%MOD
  f_mod_inverse[i]=(f_mod_inverse[i-1]*inv_mod(i)) % MOD  
pf={}
for i in range(2,int(m**0.5)+1):
    while m%i==0:
        pf[i]=pf.get(i,0)+1
        m//=i
if m>1:pf[m]=1
for i in pf.values():
  ans*=comb_mod(i+n-1,n-1)
print(ans%MOD)


### FIXED CODE ###

import sys
n,m=map(int,input().split())
MOD = 10**9+7
ans=1
if m==1:
  print(1)
  sys.exit()
def inv_mod(a, p=MOD):
    def inv_mod_sub(a, p):
        if a == 1:
            return 1, 0
        else:
            d, r = p//a, p%a
            x, y = inv_mod_sub(r, a)
            return y-d*x, x
    if p < 0: p = -p
    a %= p
    return inv_mod_sub(a,p)[0] % p

def comb_mod(n, k):
    if k < 0 or k > n:
        return 0
    else:
        return f_mod[n]*f_mod_inverse[k]*f_mod_inverse[n-k] % MOD
pf={}
for i in range(2,int(m**0.5)+1):
    while m%i==0:
        pf[i]=pf.get(i,0)+1
        m//=i
if m>1:pf[m]=1
Max=max(list(pf.values()))
f_mod=[1]*(Max+n+1)
f_mod_inverse=[1]*(Max+n+1)
for i in range(1,Max+n+1):
  f_mod[i]=(f_mod[i-1]*i)%MOD
  f_mod_inverse[i]=(f_mod_inverse[i-1]*inv_mod(i)) % MOD  
for i in pf.values():
  ans*=comb_mod(i+n-1,n-1)
print(ans%MOD)
S, T = [str(i) for i in input().split()]
 
#s = list(S)
#t = list(T)
#s_n = len(s)
#t_n = len(t)
#n = 0
#n = s_n - t_n + 1
#min = t_n
 
#for a in range(n):
  #count = 0 
	#for b in range(t_n):
      #if S[a+b] != T[b]:
        #count += 1
  #if count < min:
    #min = count
      
#print(min)

### FIXED CODE ###

x = [input() for i in range(2)]
S = x[0]
T = x[1]
moji = len(T)

for a in range(len(S) - len(T) + 1):
  count = 0
  for b in range(len(T)):
    
    if S[a+b] != T[b]:
      count += 1
  if count < moji:
    moji = count

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

jouken_1 = []
jouken_2 = []
jouken_3 = []

for _ in range(m):
    array = tuple(map(int, input().split()))
    if array[0] == 1:
        jouken_1.append(array)
    elif array[0] == 2:
        jouken_2.append(array)
    else:
        jouken_3.append(array)

a = set(jouken_1)
b = set(jouken_2)
c = set(jouken_3)
a = list(a)
b = list(b)
c = list(c)

if len(a) > 1:
    print(-1)
    exit()
elif len(b) > 1:
    print(-1)
    exit()
elif len(c) > 1:
    print(-1)
    exit()

if n == 1:
    if len(b) > 0 or len(c) > 0:
        print(-1)
        exit()
    else:
        print(a[0][1])
elif n == 2:
    if len(c) > 0:
        print(-1)
        exit()
    elif a[0][1] == 0:
        print(-1)
        exit()
    elif len(b) == 0 and len(a) == 1:
        num = a[0][1] * 10
        print(num)
    elif len(a) == 1 and len(b) == 1:
        num = b[0][1]+ a[0][1] * 10
        print(num)
elif n == 3:
    if a[0][1] == 0:
        print(-1)
        exit()
    if len(b) == 1:
        if len(c) == 1:
            num = a[0][1] * 100 + b[0][1] * 10 + c[0][1]
        else:
            num = a[0][1] * 100 + b[0][1] * 10
    else:
        if len(c) == 1:
            num = a[0][1] * 100 + c[0][1]
        else:
            num = a[0][1] * 100
    print(num)


### FIXED CODE ###

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

jouken_1 = []
jouken_2 = []
jouken_3 = []

if m == 0:
    if n == 1:
        print(0)
        exit()
    elif n == 2:
        print(10)
        exit()
    else:
        print(100)
        exit()

for _ in range(m):
    array = tuple(map(int, input().split()))
    if array[0] == 1:
        jouken_1.append(array)
    elif array[0] == 2:
        jouken_2.append(array)
    elif array[0] == 3:
        jouken_3.append(array)

a = set(jouken_1)
b = set(jouken_2)
c = set(jouken_3)
a = list(a)
b = list(b)
c = list(c)
flag = False

if len(a) > 1:
    print(-1)
    exit()
elif len(a) == 1:
    a = a[0][1]
else:
    flag = True
    a = 0

if len(b) > 1:
    print(-1)
    exit()
elif len(b) == 1:
    b = b[0][1]
else:
    b = 0

if len(c) > 1:
    print(-1)
    exit()
elif len(c) == 1:
    c = c[0][1]
else:
    c = 0

if n == 1:
    if b > 0 or c > 0:
        print(-1)
        exit()
    for i in range(10):
        if i == a:
            print(a)
            exit()
    print(-1)
elif n == 2:
    if c > 0:
        print(-1)
        exit()
    if a == 0 and flag is True:
        a = 1
    for i in range(10, 100):
        if str(i)[0] == str(a) and str(i)[1] == str(b):
            print(i)
            exit()
    print(-1)
elif n == 3:
    if a == 0 and flag is True:
        a = 1
    for i in range(100, 1000):
        if str(i)[0] == str(a) and str(i)[1] == str(b) and str(i)[2] == str(c):
            print(i)
            exit()
    print(-1)
A, B = map(int(input().sprit()))

if (A * B) % 2 == 0 :
  print('no')
else :
  print('yes')


### FIXED CODE ###

A, B = map(int, input().split())
 
if (A * B) % 2 == 0 :
  print('No')
else :
  print('Yes')
N, M = map(int, input().split())

if N > 0:
    print('Positive')
elif N <= 0 =< M:
    print('Zero')
elif M < 0:
    if N-M % 2:
        print('Negative')
    else:
        print('Positive')

### FIXED CODE ###

def solve():
    N, M = map(int, input().split())
    if N > 0:
        return 'Positive'
    elif N <= 0 <= M:
        return 'Zero'
    else:
        
        if (-(N-M)+1) % 2 == 0:
            return 'Positive'
        else:
            return 'Negative'
            
    return 0

print(solve())
x,n=map(int, input().split())
ans=x
judge=True
if(n!=0):
  p=list(map(int, input().split()))
else:
  ans=x
  judge=False

if(judge):
  check=True
  s_list=[]
  l_list=[]
  for i in range(n):
    for j in range(n):
      if(x-i==p[j]):
        check=False
    if(check):
      s_list.append(x-i)
    check=True

    for i in range(n):
      for j in range(n):
        if(x+i==p[j]):
          check=False
      if(check):
        l_list.append(x+i)
      check=True
    if(l_list == [] and s_list == []):
      ans = x-1
    else:
      if(abs(x-min(l_list)) > abs(x-max(s_list))):
        ans = max(s_list)
      elif(abs(x-min(l_list))==abs(x-max(s_list))):
        ans=max(s_list)
      else:
        ans=min(l_list)  

print(ans)

### FIXED CODE ###

x,n=map(int, input().split())
ans=x
judge=True
if(n!=0):
  p=list(map(int, input().split()))
else:
  ans=x
  judge=False
  
if(n==1):
  if(x==p[0]):
    ans = x-1
    judge=False

if(judge):
  check=True
  s_list=[]
  l_list=[]
  for i in range(n):
    for j in range(n):
      if(x-i==p[j]):
        check=False
    if(check):
      s_list.append(x-i)
    check=True

    for i in range(n):
      for j in range(n):
        if(x+i==p[j]):
          check=False
      if(check):
        l_list.append(x+i)
      check=True
    if(l_list == []):
      ans = max(s_list)
    if(s_list == []):
      ans = min(l_list)
    else:
      if(abs(x-min(l_list)) > abs(x-max(s_list))):
        ans = max(s_list)
      elif(abs(x-min(l_list))==abs(x-max(s_list))):
        ans=max(s_list)
      else:
        ans=min(l_list)  

print(ans)
import sys
def input(): return sys.stdin.readline().rstrip()
import numpy as np
def main():
    h,n=map(int,input().split())
    lis=np.array([list(map(int,input().split())) for _ in range(n)])
    a_max=np.max(lis[:,0])
    dp=np.full(h+a_max+1,10**10)
    dp[0]=0
    for l in lis:
        dp[i:i+l[0]+1]=np.minimum(dp[i:i+l[0]+1],dp[i]+l[1])
    print(dp)
    print(dp[h])

if __name__=='__main__':
    main()

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().rstrip()
import numpy as np
def main():
    h,n=map(int,input().split())
    lis=np.array([list(map(int,input().split())) for _ in range(n)])
    dp=np.zeros(10**4+1,int)
    dp[0]=0
    for l in lis:
        dp[1:l[0]+1]=np.minimum(dp[1:l[0]+1],l[1])
    for i in range(1,h+1):
        dp[i]=np.min(dp[i-lis[:,0]]+lis[:,1])
    print(dp[h])

if __name__=='__main__':
    main()
a,b = input().split()
if (a*b)%2==0:
  print('Even')
else:
  print('Odd')

### FIXED CODE ###

a,b = map(int, input().split())
if (a*b)%2==0:
  print('Even')
else:
  print('Odd')
inputlist = [input() for i in range(4)]

n = 0

A,B,C= inputlist[0],inputlist[1],inputlist[2]

for i in range(int(A)+1):

    X = inputlist[3] 

    X500 = int(X) - i*500

    for j in range(int(B)+1):

        X100 = X - j*100

        for k in range(int(C)+1):

            X50 = X -k*50

            if X50 == 0:
                n += 1

print(n)

### FIXED CODE ###

A,B,C,X = [int(input()) for i in range(4)]
X_original = X
n = 0

for i in range(int(A)+1):
    X = X_original
    X500 = X - i*500
    for j in range(int(B)+1):
        X100 = X500 - j*100
        for k in range(int(C)+1):
            X50 = X100-k*50
            if X50== 0:
                n += 1

print(n)
n, m = map(int,input().split())
s = [list(map(int,input().split())) for i in range(m)]
nl = [[] for i in range(n+1)]
for a,b in s: nl[a].append(b
can = False
for i in range(2,n):
    if i in nl[1] and n in nl[i]: can = True 
ans = "POSSIBLE" if can else "IMPOSSIBLE"
print(ans)

### FIXED CODE ###

n, m = map(int,input().split())
s = [list(map(int,input().split())) for i in range(m)]
nl = [[0,0] for i in range(n+1)]
for a,b in s:
    if a == 1: nl[b][0] = 1
    if b == n: nl[a][1] = 1
ans = "POSSIBLE" if [1,1] in nl else "IMPOSSIBLE"
print(ans)
n = int(input())
aas = sorted(list(set(list(map(int, input().split())))))
aas_len = len(aas)
if aas_len == 1:
    print(0)
    exit()
aas_max = aas[-1]
arr = [1]*(aas_max+1)
for i in range(aas_len):
    if arr[aas[i]] == 0:
        continue
    idx = aas[i]*2
    while idx <= aas_max:
        arr[idx] = 0
        idx += aas[i]
res = 0
for i in aas:
    if arr[i] == 1:
        res += 1
print(res)

### FIXED CODE ###

n = int(input())
aas = sorted(list(map(int, input().split())))
aas_len = len(aas)
if aas_len == 1:
    print(1)
    exit()
aas_max = aas[-1]
arr = [1]*(aas_max+1)
for i in range(aas_len):
    if arr[aas[i]] == 0:
        continue
    if arr[aas[i]] == 1:
        arr[aas[i]] = 2
    else:
        arr[aas[i]] = 0
        continue
    idx = aas[i]*2
    while idx <= aas_max:
        arr[idx] = 0
        idx += aas[i]
res = 0
for i in aas:
    if arr[i] != 0:
        res += 1
print(res)
def gcd(a, b):
    while True:
        a, b = b, a%b
        if b == 0:
            return

def lcm(a, b):
    return int((a*b) // gcd(a, b))

a, b = map(int, input().split())

print(lcm(a, b))

### FIXED CODE ###

A, B = map(int, input().split())
import fractions

print(int(A*B/fractions.gcd(A,B)))
x = input()
print(x**3)

### FIXED CODE ###

x = input()
y = int(x)**3
print(y)
from _collections import deque

_temp = deque([])
my_max = []

size = int(input().rstrip())
for i in range(size):
    try:
        _temp.append(int(input()))
    except EOFError:
        continue


for val in list(_temp)[:-1]:
    v = _temp.popleft()
    my = max(_temp) - v

    if len(my_max) == 0:
        my_max.append(my)
    else:
        if my > max(my_max):
            my_max.append(my)

print(max(my_max))

### FIXED CODE ###

_temp = []

size = int(input().rstrip())
for i in range(size):
    try:
        _temp.append(int(input()))
    except EOFError:
        continue

my_max = -20000000000000
my_min = _temp.pop(0)


for val in _temp:
    my_max = max(my_max, (val - my_min))
    my_min = min(my_min, val)

print(my_max)
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

def lcm(a, b):
    g = gcd(a,b)
    return a / g * b

N = int(input())
T = [int(input()) for i in range(N)]
ans = 1
for i in range(len(T)):
    ans = lcm(ans, T[i])

print(int(ans))

### FIXED CODE ###

import math
from functools import reduce

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

def lcm_list(list):
    return reduce(lcm_base, list, 1)

N = int(input())
T = [int(input()) for i in range(N)]

print(lcm_list(T))
N, M = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(M)]
dic = {}

# 一桁で0のときの対応
if sc == [] and N == 1:
    print(0)
    exit()
if sc == [[1, 0]] and N == 1:
    print(0)
    exit()

# 文字を組み立てます。
for k in sc:
    if k[0] in dic:
        if dic[k[0]] != k[1]:  # 重なったら即アウト
            print(-1)
            exit()
    else:
        dic[k[0]] = k[1]
ans = 0

if 1 in dic and dic[1] == 0:  # 一桁めが存在するかどうか判定している。
    print(-1)
    exit()
for k in dic:
    ans += 10**(N - k) * dic[k]
if ans < 10**(N - 1):
    ans += 10**(N - 1)
print(ans)


### FIXED CODE ###

N=int(input())
if N%2==0:
  ans=N/2
else:
  ans=N//2+1
print(int(ans))
import math
L = [int(input()) for _ in range(5)]
Lm = 10-min([i%10 for i in L if i%10 != 0])
if not Lm:
    Lm = 0
print(sum([10*math.ceil(i/10) for i in L])-Lm)





### FIXED CODE ###

import math
L = [int(input()) for _ in range(5)]
Lm = []
for i in L:
    if i%10 == 0:
        Lm.append(0)
    else:
        Lm.append(10-i%10)
print(sum([10*math.ceil(i/10) for i in L])-max(Lm))
S=list(input())
T=list(input())
c=0
for u,v = zip(S,T):
    if u==v:
        c+=1
print(c)

### FIXED CODE ###

S = list(input())
T = list(input())
c = 0
for _ in range(3):
    if S[_] == T[_]:
        c += 1
print(c)
n=int(input())
p=list(map(int,input().split()))
r=p[:]

ans=0
for i in range(n):
  if p[i]==i+1:
    ans+=1
    p[i]=r[i+1]
    p[i+1]=r[i]
    
print(ans)

### FIXED CODE ###

n=int(input())
p=list(map(int,input().split()))
r=p[:]

ans=0
for i in range(n):
  if p[i]==i+1:
    ans+=1
    if i!=n-1:
      p[i]=r[i+1]
      p[i+1]=r[i]
      
print(ans)
# https://beta.atcoder.jp/contests/abc057/tasks/abc057_b


class Point(object):
    def __init__(self, x, y):
        self.x = int(x)
        self.y = int(y)

    @staticmethod
    def manhattan(p1, p2):
        return abs(p1.x - p2.x) + abs(p1.y - p2.y)

    def __str__(self):
        return f'(x, y) = ({self.x}, {self.y})'


def solve():
    # Max(n, m) = (50, 50) => 50 * 2
    n, m = map(int, input().split())
    students = []
    for _ in range(n):
        students.append(Point(*input().split()))

    checkpoints = []
    for _ in range(m):
        checkpoints.append(Point(*input().split()))

    for student in students:
        min_dist = 4 * (10 ** 8)
        min_index = 1
        for index, cp in enumerate(checkpoints):
            manhattan = Point.manhattan(student, cp)
            if min_dist > manhattan:
                min_dist = manhattan
                min_index = index + 1
        print(min_index)


if __name__ == '__main__':
    solve()


### FIXED CODE ###

# https://beta.atcoder.jp/contests/abc057/tasks/abc057_b
class Point(object):
    def __init__(self, x, y):
        self.x = int(x)
        self.y = int(y)

    @staticmethod
    def manhattan(p1, p2):
        return abs(p1.x - p2.x) + abs(p1.y - p2.y)

def solve():
    # Max(n, m) = (50, 50) => 50 * 2
    n, m = map(int, input().split())
    students = []
    for _ in range(n):
        students.append(Point(*input().split()))

    checkpoints = []
    for _ in range(m):
        checkpoints.append(Point(*input().split()))

    for student in students:
        min_dist = 4 * (10 ** 8)
        min_index = 1
        for index, cp in enumerate(checkpoints):
            manhattan = Point.manhattan(student, cp)
            if min_dist > manhattan:
                min_dist = manhattan
                min_index = index + 1
        print(min_index)


if __name__ == '__main__':
    solve()
a, b, c = input().split()
if a < b and b < c:
  print 'No'
elif a < c and c < b:
  print 'Yes'
elif b < c and c < a:
  print 'Yes'
elif b < a and a < c:
  print 'No'
elif c < a and a < b:
  print 'Yes'
elif c < b and b < a:
  print 'No'

### FIXED CODE ###

a, b, c = input().split()
if (int(a) < int(c) and int(c) < int(b)) or (int(b) < int(c) and int(c) < int(a)):
  print('Yes')
else:
  print('No')
N = int(input())
A = list(map(int, input().split())
         
ans = [0] * N
for i in range(N):
         ans[A[i] - 1] = i + 1
    
print(" ".join(map(str, ans)))
         

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
         
ans = [0] * N
for i in range(N):
         ans[A[i] - 1] = i + 1
    
print(" ".join(map(str, ans)))
a,b=(int(x) for x in input().split())
#print(a)
#print(b)

am=int(100/8*a)
al=int(100/8*(a+1))
if ((a+1)%4)==0:
       al=al-1

bm=int(10*b)
bl=int(10*(b+1))-1

#print (am,al)
#print (bm,bl)
for ia in range(am,al):
       for ib in range(bm,bl):
       		if ia==ib:
       			print (ia)
       			exit()
else:
  print(-1)

### FIXED CODE ###

str=input()
if str=="AAA" or str=="BBB":
  print ("No")
else:
  print ("Yes")
def LCS():
    seq1 = raw_input()
    seq2 = raw_input()
 
    a, b = len(seq1), len(seq2)
    for i in range(b + 1):
      c1[i] = 0 
    for i in range(a):
        e1 = seq1[i]
        c2 = c1+[]
        for j in range(b):
            if e1 == seq2[j]:
                c1[j+1] = c2[j] + 1
            elif c1[j+1] < c1[j]:
                c1[j+1] = c1[j]
    return c1[-1]
 
n = input()
for i in range(n):
    print LCS()

### FIXED CODE ###

def LCS():
    X = raw_input()
    Y = raw_input()
 
    a, b = len(X), len(Y)
    c1 = [0 for i in range(b+1)]
    for i in range(a):
        e1 = X[i]
        c2 = c1+[]
        for j in range(b):
            if e1 == Y[j]:
                c1[j+1] = c2[j] + 1
            elif c1[j+1] < c1[j]:
                c1[j+1] = c1[j]
    return c1[-1]
 
n = input()
for i in range(n):
    print LCS()
l = input()
dp1 = [0] * (len(l)+1)
dp2 = [0] * (len(l)+1)

dp1[1] = 1
dp2[1] = 2
if l == '1':
  print(3)
  exit()
for i in range(1, len(l)):
  if l[i] == '0':
  	dp1[i+1] = 3 * dp1[i] + 1 * dp2[i]
    dp1[i+1] %= 1000000007
  	dp2[i+1] = dp2[i]
  else:
    dp1[i+1] = 3 * dp1[i] + 3 * dp2[i]
    dp1[i+1] %= 1000000007
    dp2[i+1] = 3 * dp2[i]
    dp2[i+1] %= 1000000007

print(dp1[len(l)] % 1000000007)

### FIXED CODE ###

l = input()
dp1 = [0] * (len(l)+1)
dp2 = [0] * (len(l)+1)
 
dp1[1] = 1
dp2[1] = 2
if l == '1':
  print(3)
  exit()
for i in range(1, len(l)):
  if l[i] == '0':
    dp1[i+1] = 3 * dp1[i]
    dp1[i+1] %= 1000000007
    dp2[i+1] = dp2[i]
  else:
    dp1[i+1] = 3 * dp1[i] + dp2[i]
    dp1[i+1] %= 1000000007
    dp2[i+1] = 2 * dp2[i]
    dp2[i+1] %= 1000000007
print((dp1[len(l)] + dp2[len(l)]) % 1000000007)
mod = 10**9+7
N,K = map(int,input().split())
g = [[] for _ in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)


ans = K
def rec(c,p):
    global ans
    if c == 0:
        for i in range(len(g[0])):
            ans *= K-i-1
            ans %= mod
        for v in g[c]:
            if v != p:
                rec(v,c)
    else:
        for i in range(len(g[c])-1):
            ans *= K-i-2
            ans %= mod
        for v in g[c]:
            if v != p:
                rec(v,c)


rec(0,0)
print(ans)

### FIXED CODE ###

from collections import deque
mod = 10**9+7
N,K = map(int,input().split())
e = [[] for _ in range(N)]
d = {}
for _ in range(N-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    e[a].append(b)
    e[b].append(a)
    d[(min(a,b),max(a,b))] = 0
ans = K
parents = deque([0])

n = [0]*N
while parents:
    p = parents.popleft()
    for c in e[p]:
        if d[(min(p,c),max(p,c))] == 0:
            d[(min(p,c),max(p,c))] = 1
            n[p] += 1
            n[c] += 1
            parents.append(c)
            ans *= K-n[p]
            ans %= mod

print(ans)
a,b=map(int,input().split())↲
d=0
c=a*3
if c>1:
    d=(c+b)//2
elif c==0 and b>1:
    d=b//2
print(d)↲


### FIXED CODE ###

a, p = map(int, input().split())
#print (int((a*3 + p) / 2))
#a,p=map(int,input().split())↲
print(int((a*3+p)/2))
def myAnswer(N:int,P:list) -> int:
   ans = 0
   counter = 0
   for i in range(1,N+1):
      if(i == P[i - 1]):
         counter += 1
      elif(counter != 0):
         ans += sum(divmod(counter,2))
         counter = 0
   if(counter != 0):
      ans += sum(divmod(counter,2))
   return ans

def modelAnswer(N:int,P:list) -> int:
   ans = 0
   for i in range(1,N+1):
      if(i == P[i - 1]):
         ans += 1
         P[i - 1],P[i] = P[i],P[i - 1]
   return ans

def main():
   N = int(input())
   P = list(map(int,input().split()))
   print(modelAnswer(N,P[:]))
if __name__ == '__main__':
   main()

### FIXED CODE ###


def myAnswer(N:int,P:list) -> int:
   ans = 0
   counter = 0
   for i in range(1,N+1):
      if(i == P[i - 1]):
         counter += 1
      elif(counter != 0):
         ans += counter//2 + counter % 2 if(counter > 1) else 1
         counter = 0
   if(counter != 0):
      ans += counter//2 + counter % 2 if(counter > 1) else 1
   return ans

def modelAnswer():
   return
def main():
   N = int(input())
   P = list(map(int,input().split()))
   print(myAnswer(N,P[:]))
if __name__ == '__main__':
   main()
import sys

for lineCnt, line in enumerate(sys.stdin):
    if lineCount == 0: continue
    a, b, c = map(int, line.rstrip('\n').split(' '))
    if a+b>c and b+c>a and c+a>b:
        print 'YES'
    else:
        print 'NO'

### FIXED CODE ###

import sys

for lineCount, line in enumerate(sys.stdin):
    if lineCount == 0:
        continue
    a, b, c = sorted(map(int, line.split(' ')))
    if a**2 + b**2 == c**2:
        print 'YES'
    else:
        print 'NO'
N, M = map(int, input().split())
f = [set() for _ in range(N)]
v = [False for _ in range(N)]
ans = 1

for _ in range(M):
  a, b = map(int, input().split())
  a, b = a - 1, b - 1
  f[a].add(b)
  f[b].add(a)
  
  
def dfs(fi):
  if v[fi]: return 0
  
  v[fi] = True
  cnt = 1
  
  for fr in f[fi]:
    cnt += dfs(fr)
    
  return cnt

for i in range(N):
  cnt = dfs(i)
  ans = max(ans, cnt)
  
print(ans)
  

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

N, M = map(int, input().split())
f = [set() for _ in range(N)]
v = [False for _ in range(N)]
ans = 1

for _ in range(M):
  a, b = map(int, input().split())
  a, b = a - 1, b - 1
  f[a].add(b)
  f[b].add(a)
  
  
def dfs(fi):
  if v[fi]: return 0
  
  v[fi] = True
  cnt = 1
  
  for fr in f[fi]:
    cnt += dfs(fr)
    
  return cnt

for i in range(N):
  cnt = dfs(i)
  ans = max(ans, cnt)
  
print(ans)
x=raw_input().split()
print x[0]*x[1],(x[0]+x[1])*2

### FIXED CODE ###

x,y=map(int, raw_input().split())
print x*y,(x+y)*2
import math
X, D = map(int, input().split())
n = 0
for i in range(N):
  x, y = map(int, input().split())
  if math.sqrt(x**2+y**2) <= D:
    n += 1
print(n)

### FIXED CODE ###

import sys
import math

count = 0
N, D = map(int, input().split())
for _ in range(N):
  x, y = map(int, input().split())
  dis = math.sqrt(x ** 2 + y ** 2)
  if dis <= D:
    count += 1
print(count)
c = str(inout())
if c = 'a' or 'e' or 'i' or 'o' or 'u' :
  print('vowel')
else :
  print('consonant')

### FIXED CODE ###

C = ["a","e","i","o","u"]
print("vowel" if input() in C else "consonant")