n=int(input()
l = [int(x) for x in input().split()
l.sort()
u = 0
a= 0
while(u<=n)
    a+=1
    c=0
    for i in range(n):
        if(l[i]>=c):
            c+=1
            u+=1
            l[i]= -1
print(a)


def main():
    a, b = map(int, input().split())
    s = input()
    x = sum({"L": -1, "R": 1}.get(c, 0) for c in s)
    y = sum({"D": -1, "U": 1}.get(c, 0) for c in s)
    if x and y:
        t = min(a // x, b // y)
    elif x:
        t = a // x
    elif y:
        t = b // y
    if t > 0:
        a -= (t - 1) * x
        b -= (t - 1) * y
    for c in s * 2:
        if a == 0 == b:
            print("Yes")
            return
        a -= {"L": -1, "R": 1}.get(c, 0)
        b -= {"D": -1, "U": 1}.get(c, 0)
    print("No")

if __name__ == '__main__':
    main()


[x,y]=[int(i) for i in raw_input().split()]
s=raw_input()
pos=[(0,0)]
j=0
for i in s:
    if i=='U':
        pos.append((pos[j][0],pos[j][1]+1))
        j+=1
    if i=='D':
        pos.append((pos[j][0],pos[j][1]-1))
        j+=1
    if i=='L':
        pos.append((pos[j][0]-1,pos[j][1]))
        j+=1
    if i=='R':
        pos.append((pos[j][0]+1,pos[j][1]))
        j+=1
if (x,y) in pos:
    print "Yes"
else:
    try:
        j=x/pos[-1][0]
    except ZeroDivisionError:
        j=0
    try:
        i=y/pos[-1][1]
    except ZeroDivisionError:
        i=0
    x1=x-(j*pos[-1][0])
    y1=y-(j*pos[-1][1])
    x2=x-(i*pos[-1][0])
    y2=y-(i*pos[-1][1])
    (x3,y3)=(x1,y1)-pos[-1]
    (x4,y4)=(x1,y1)+pos[-1]
    (x5,y5)=(x2,y2)-pos[-1]
    (x6,y6)=(x2,y2)+pos[-1]
    if (x1,y1) in pos or (x2,y2) in pos or (x3,y3) in pos or (x4,y4) in pos or (x5,y5) in pos or (x6,y6) in pos :
        print "Yes"
    else:
        print "No"
##[r,g,b]=[int(i) for i in raw_input().split()]
##mini=min([r,g,b])
##mix=mini-(mini/3)
##a=[]
##for i in [r,g,b]:
##    rb=(r-i)/3
##    bb=(b-i)/3
##    gb=(g-i)/3
##    a.append(i+rb+bb+gb)
##a.append(r/3 + b/3 +g/3)
###print(a)
##print max(a)
####
######[n,m]=[int(i)  for i in raw_input().split()]
######print m+n-1
######for i in range(m):
######    print 1,i+1
######for i in range(1,n):
######    print i+1,1


def gcd(x,y):
    r = x % y
    while r != 0:
        x = y
        y = r
        r = x % y

    return y

def go(command,now):
    if command == "U":
        return (now[0],now[1]+1)
    elif command == "D":
        return (now[0],now[1]-1)
    elif command == "R":
        return (now[0]+1,now[1])
    else:
        return (now[0]-1,now[1])

def same_hugo(x,y):
    if x < 0 and y < 0:
        return True

    if x > 0 and y > 0:
        return True

    if x == 0 and y == 0:
        return True

    return False

def solver():
    a,b = map(int, raw_input().split())
    command = raw_input()
    if (a,b) == (0,0):
        print "Yes"
        return
    sa = []
    now = (0,0)
    first = []
    for c in command:
        now = go(c,now)
        sa.append((a-now[0],b-now[1]))
        first.append(now)
        if now == (a,b):
            print "Yes"
            return

    for i in range(len(command)):
        now = go(command[i],now)
        temp_sa = sa[i]
        temp_first = first[i]
        sinpo = (now[0] - temp_first[0], now[1]-temp_first[1])
        #print temp_sa,sinpo,now,temp_first

        if temp_sa[0] == 0:
            if sinpo[0] == 0:
                if temp_sa[1] == 0:
                    if sinpo[1] == 0:
                        print "Yes"
                        return
                else:
                    if temp_sa[1] % sinpo[1] == 0:
                        if same_hugo(temp_sa[1],sinpo[1]):
                            print "Yes"
                            return
        elif temp_sa[1] == 0:
            if sinpo[1] == 0:
                if temp_sa[0] % sinpo[0] == 0:
                    if same_hugo(temp_sa[0],sinpo[0]):
                        print "Yes"
                        return
        else:
            #print temp_sa

            num = abs(gcd(temp_sa[0],temp_sa[1]))
            if temp_sa[0]/num == sinpo[0] and temp_sa[1]/num == sinpo[1]:
                print "Yes"
                return

    print "No"

if __name__ == "__main__":
    solver()


def inoneline(sol, move, final):
    vec=(final[0]-sol[0], final[1]-sol[1])
    cross=vec[1]*move[1]+vec[0]*move[0]
    if cross <= 0:
        return False
    veclen = vec[1]**2+vec[0]**2
    movlen = move[0]**2+move[1]**2
    if cross**2 != veclen*movlen:
        return False
    if veclen%movlen!=0:
        return False
    return True

a, b = map(int, raw_input('').split())
movements=raw_input('')
steps={'U':(0, 1), 'D':(0, -1), 'L':(-1, 0), 'R':(1, 0)}
px, py=0, 0
posols=set([(px, py)])
for movement in movements:
    x, y = steps[movement]
    px+=x
    py+=y
    posols.add((px, py))
    if (a, b) == (px, py):
        print 'YES'
        exit()

if(px, py)==(0, 0):
    print 'NO'
    exit()

for posol in posols:
    if inoneline(posol, (px, py),(a, b)):
        answer='Yes'

print answer


x,y = map(int,input().split())
#print(x,y)
s = input()
#print(s)
pt = (0,0)
path = [(0,0)]
rect = [0,0,1,1]
for c in s:
    if c == 'U': pt = (pt[0],pt[1]+1)
    elif c == 'D': pt = (pt[0],pt[1]-1)
    elif c == 'L': pt = (pt[0]-1,pt[1])
    elif c == 'R': pt = (pt[0]+1,pt[1])

    if pt[0] < rect[0]: rect[0] = pt[0]
    if pt[0] >= rect[2]: rect[2] = pt[0]+1
    if pt[1] < rect[1]: rect[1] = pt[1]
    if pt[1] >= rect[3]: rect[3] = pt[1]+1

    path.append(pt)

#print(pt)
#print(path)
#print(rect)

done = False
if pt[0] == 0:
    if pt[1] == 0:
        if (x,y) in path:
            done = True
            print("Yes")
        else:
            print("No")
            done = True
    elif pt[1] > 0:
        n = max((y-rect[3])//pt[1]-2,0)
        while n*pt[1]+rect[1] <= y:
            if (x - n*pt[0],y - n*pt[1]) in path:
                print("Yes")
                done = True
                break
            n += 1
    elif pt[1] < 0:
        n = max((y - rect[1])//pt[1]-2,0)
        while n*pt[1]+rect[3] >= y:
            if (x - n*pt[0],y-n*pt[1]) in path:
                print("Yes")
                done = True
                break
elif pt[0] > 0:
    n = max((x-rect[2])//pt[0]-2,0)
    while n*pt[0]+rect[0] <= x:
        if (x - n*pt[0],y - n*pt[1]) in path:
            print("Yes")
            done = True
            break
        n += 1
elif pt[0] < 0:
    n = max((x-rect[0])//pt[0]-2,0)
    while n*pt[0]+rect[2] >= x:
        if (x - n*pt[0],y - n*pt[1]) in path:
            print("Yes")
            done = True
            break
        n += 1

if not done:
    print("No")


def get_instability(w, x, y):
    total = 0
    last = -1

    for i in range(len(w)):
        if i == x or i == j:
            continue

        if last == -1:
            last = w[i]
        else:
            total += w[i] - last
            last = -1

    return total

def main():
    n = int(input())
    weights = sorted(list(map(int, input().split())))

    min_instability = (1 << 30)
    for i in range(2 * n):
        for j in range(i + 1, 2 * n):
            instability = get_instability(weights, i, j)
            if instability < min_instability:
                min_instability = instability

    print(min_instability)

main()


raw_input()
x = sorted(map(int,raw_input().split()))
def solve(x,rm,nx,ins):
    if nx == len(x):
        if rm == 2:
            return ins
        return float("inf")
    if nx == len(x)-1:
        if rm == 1:
            return ins
        return float("inf")
    return min(solve(x,rm+1,nx+1,ins),solve(x,rm,nx+2,ins+x[nx+1]-x[nx]))
print solve(x,0,0,0)


n = int(input())
w = input()
print(w)
weights = [int(x) for x in w.split[" "]]
print(n, weights)
weights.sort()

# instability if i, j are single kayakers
def get_instability(i, j):
    test = list(weights)
    test.pop(i)
    test.pop(j)
    instability = 0
    for k in range(0, len(test) - 1, 2):
        instability += abs(weights[k] - weights[k+1])
    return instability

instabilities = []
for i in range(len(weights)):
    for j in range(len(weights)):
        if i == j:
            continue
        instabilities.append(get_instability(i, j))

print min(instabilities)


n=2*int(input())
w=sorted(map(int,input().split()))
r=10000
for i in range(n):
    for j in range(i):
        u=[w[k] for k in range(n) if i!=k!=j)
        r=min(r,sum(u[i+1]-u[i] for i in range(0,n-3,2)))
print(r)


n = int (input())
w = list(map(int, input().split()))
w.sort()
swd=[0,0]
for i in range(n*2-1):
    swd.append(swd[i]+(w[i+1]-w[i]))
m = swd[n*2]
for i in range(n):
    for j in range(0,n-i):
        s = swd[i*2] +  swd[(i+j)*2+1]-swd[i*2+1] + swd[n*2]-swd[(i+j+1)*2]
        if s<m:
            m=s
print m


p, y = map(int,input().split())
a = list()
for i in range(2,p+1):
    for j in range(1,(y//2)+1):
        if(i*j<=y):
          a.append(i*j)

#print(a)
b = list()
for i in range(2,y+1):
    b.append(i)
#print(b)
z = list(set(b)-set(a))
z.sort(reverse=True)
if(len(z)>0):
    print(z[0])
else:
    print(-1)


p, y = map(int, input().split())

l = []
ans = -1
for i in range(2, p+1):
  x = 1
  while i*x <= y:
    if i*x not in l:
      l.append(i*x)
    x += 1
for i in range(y, 1,-1):
  if i not in l:
    ans = i
    break
print(ans)


#include <iostream>
#include <map>
#include <cmath>
#include <vector>

using namespace std;

int p, y;

bool IsPrime(int x) {
	for (int i = 2; i*i <= x; ++i) {
		if (x % i == 0) return false;
	}
	return true;
}

int main() {
	while (cin >> p >> y) {
		int i;
		for (i = y; i > p; --i) {
			if (IsPrime(i)) {
				cout << i << endl;
				break;
			}
		}
		if (i == p) cout << -1 << endl;
	}
	return 0;
}


	'''input
	3 6
	'''
	from sys import exit
	def primes(n,p):
		if n%2 == 0:
			return False
		d = 2
		while d*d <= n:
			while (n % d) == 0:
				n = n//d
				if d < p:
					return False
			d += 1
		return True

	p,n = map(int,raw_input().split())
	for i in range(n,p,-1):
		if primes(i,p):
			print i
			exit(0)
	print "-1"


#include<stdio.h>
#include<math.h>

int check(int n){
	int limit = ceil((double)sqrt(n));
	int i;
	for(i=3; i<=limit; i+=2){
		if(n%i==0){
			return(i);
		}
	}
	return(n);
}

int main(){
	int p,y,i;
	scanf("%d %d",&p, &y);
	int ans=-1;
	if(y%2==0){
		y--;
	}

	for(i=y ; i>p ; i-=2){
		int q = check(i);
		if(q>p){
			ans=i;
			break;
		}
	}
	printf("%d\n",ans);
}


from math import ceil, floor

def readint():
    return int(input())

def readline():
    return [int(c) for c in input().split()]

def main():
    la, ra, ta = readline()
    lb, rb, tb = readline()

    res = []
    if lb > la:
        left_limit_left = int(ceil((lb - la) / ta))
        left_limit_right = int(floor((rb - la) / ta))

        kl = list(range(left_limit_left, left_limit_right+1))
        for k in kl:
            lla = la + k * ta
            rra = ra + k * ta
            res.append(min(rra, rb) - max(lla, lb) + 1)

        right_limit_left = int(ceil((lb - ra) / ta))
        right_limit_right = int(floor((rb - ra) / ta))
        kr = list(range(right_limit_left, right_limit_right+1))
        for k in kr:
            lla = la + k * ta
            rra = ra + k * ta
            res.append(min(rra, rb) - max(lla, lb) + 1)

        print(max(res))
    else:
        left_limit_left = int(ceil((la - lb) / tb))
        left_limit_right = int(floor((ra - lb) / tb))
        kl = list(range(left_limit_left, left_limit_right+1))
        for k in kl:
            llb = lb + k * tb
            rrb = rb + k * tb
            res.append(min(rrb, ra) - max(llb, la) + 1)

        right_limit_left = int(ceil((la - rb) / tb))
        right_limit_right = int(floor((ra - rb) / tb))
        kr = list(range(right_limit_left, right_limit_right+1))
        for k in kr:
            llb = lb + k * tb
            rrb = rb + k * tb
            res.append(min(rrb, ra) - max(llb, la) + 1)

        print(max(res))

if __name__ == '__main__':
    main()


#!/usr/bin/env python
"""
This file is part of https://github.com/Cheran-Senthil/PyRival.

Copyright 2018 Cheran Senthilkumar all rights reserved,
Cheran Senthilkumar <hello@cheran.io>
Permission to use, modify, and distribute this software is given under the
terms of the MIT License.

"""
from __future__ import division, print_function

import cmath
import itertools
import math
import operator as op
# import random
import sys
from atexit import register
from bisect import bisect_left, bisect_right
# from collections import Counter, MutableSequence, defaultdict, deque
# from copy import deepcopy
# from decimal import Decimal
# from difflib import SequenceMatcher
# from fractions import Fraction
# from heapq import heappop, heappush

if sys.version_info[0] < 3:
    # from cPickle import dumps
    from io import BytesIO as stream
    # from Queue import PriorityQueue, Queue
else:
    # from functools import reduce
    from io import StringIO as stream
    from math import gcd
    # from pickle import dumps
    # from queue import PriorityQueue, Queue

if sys.version_info[0] < 3:
    class dict(dict):
        """dict() -> new empty dictionary"""
        def items(self):
            """D.items() -> a set-like object providing a view on D's items"""
            return dict.iteritems(self)

        def keys(self):
            """D.keys() -> a set-like object providing a view on D's keys"""
            return dict.iterkeys(self)

        def values(self):
            """D.values() -> an object providing a view on D's values"""
            return dict.itervalues(self)

    def gcd(x, y):
        """gcd(x, y) -> int
        greatest common divisor of x and y
        """
        while y:
            x, y = y, x % y
        return x

    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

def sync_with_stdio(sync=True):
    """Set whether the standard Python streams are allowed to buffer their I/O.

    Args:
        sync (bool, optional): The new synchronization setting.

    """
    global input, flush

    if sync:
        flush = sys.stdout.flush
    else:
        sys.stdin = stream(sys.stdin.read())
        input = lambda: sys.stdin.readline().rstrip('\r\n')

        sys.stdout = stream()
        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

def main():
    n, m, l = map(int, input().split(' '))
    a = list(map(int, input().split(' ')))
    points_to_cut = [1 if i > l else 0 for i in a]

    starts, ends = set(), set()
    if points_to_cut[0] == 1:
        starts.add(0)

    for i, pi in enumerate(points_to_cut):
        if i == 0:
            continue
        if pi == 0:
            if points_to_cut[i - 1] == 1:
                ends.add(i - 1)
        if pi == 1:
            if points_to_cut[i - 1] == 0:
                starts.add(i)

    if points_to_cut[-1] == 1:
        ends.add(n - 1)

    for _ in range(m):
        q = list(map(int, input().split(' ')))
        if q[0] == 0:
            print(len(starts))
        else:
            a[q[1] - 1] += q[2]
            if a[q[1] - 1] > l:
                if points_to_cut[q[1] - 1] == 0:
                    if (q[1] in starts) and ((q[1] - 2) in ends):
                        starts.remove(q[1])
                        ends.remove(q[1] - 2)
                    elif q[1] in starts:
                        starts.remove(q[1])
                        starts.add(q[1] - 1)
                    elif (q[1] - 2) in ends:
                        ends.remove(q[1] - 2)
                        ends.add(q[1] - 1)
                    else:
                        starts.add(q[1] - 1)
                        ends.add(q[1] - 1)

                    points_to_cut[q[1] - 1] = 1

if __name__ == '__main__':
    sync_with_stdio(False)

    if 'PyPy' in sys.version:
        from _continuation import continulet

        def bootstrap(c):
            callable, arg = c.switch()
            while True:
                to = continulet(lambda _, f, x: f(x), callable, arg)
                callable, arg = c.switch(to=to)

        c = continulet(bootstrap)
        c.switch()

        main()

    else:
        import threading

        sys.setrecursionlimit(2097152)
        threading.stack_size(134217728)

        main_thread = threading.Thread(target=main)
        main_thread.start()
        main_thread.join()


is_valid=1
is_error=0
mp=[-1,31,28,31,30,31,30,31,31,30,31,30,31]
dbm=[-1]
db=0
for dim in mp:
	dbm.append(db)
	db+=dim

def is_leap_year(year):
	if year%4==0 and year%100==0:
		return 1
	elif year%4==0:
		return 1

def dby(year):
	nyear=year-1
	return nyear*365+nyear//4-nyear//100+nyear//400

def calc_days_in_month(month,year):
	if month==2:
		if is_leap_year(year)==1:
			return 29
		else:
			return 28
	return mp[month]

def days_previous_month(month,year):
	return dbm[month]+(month>2 and is_leap_year(year))

def no_of_days_from_start(year,month,day):
	return dby(year)+days_previous_month(month,year)+day

f=open("input.txt","r")
T=f.readline()
D=T.split()
f.close()

D1=D[0].split("/")
D2=D[1].split("/")

d1=int(D1[0])
m1=int(D1[1])
y1=int(D1[2])

d2=int(D2[0])
m2=int(D2[1])
y2=int(D2[2])

if d1<1 or d1>calc_days_in_month(m1,y1) or m1<1 or m1>12:
	is_error=1

if d2<1 or d2>calc_days_in_month(m2,y2) or m2<1 or m2>12:
	is_error=1

if y1<2019:
	is_valid=0
if y2<2019:
	is_valid=0

if y1==2019 :
	if m1==12:
		if d1<30:
			is_valid=0
	else:
		is_valid=0

if y2==2019:
	if m2==12:
		if d2<30:
			is_valid=0
	else:
		is_valid=0

tot_no_of_days1=no_of_days_from_start(y1,m1,d1)
tot_no_of_days2=no_of_days_from_start(y2,m2,d2)

w1=tot_no_of_days1
w2=tot_no_of_days2

if w1>w2:
	is_valid=0

temp=tot_no_of_days1//7
w1-=2*temp
temp=tot_no_of_days1%7
if temp==0:
	w1-=1
elif temp>=1:
	w1-=2

temp=tot_no_of_days2//7
w2-=2*temp
temp=tot_no_of_days2%7
if temp==0:
	w2-=1
elif temp>=1:
	w2-=2

f=open("output.txt","w")
if is_error==1:
	f.write("error")
elif not is_valid ==1:
	f.write("invalid")
else:
	ans=w2-w1
	if tot_no_of_days1%7!=0 and tot_no_of_days1%7!=1:
		ans+=1
	f.write(str(ans))
f.close()


def solve(la, ra, ta, lb, rb, tb):
    if la > lb:
        la, ra, ta, lb, rb, tb = lb, rb, tb, la, ra, ta
    da = ra-la
    db = rb-lb
    ans = 0
    dist = lb - la
    dist %= ta
    if dist == 0:
        return min(da+1, db+1)
    if tb % ta:
        dist %= ta % (tb % ta)
        la, ra = lb - dist, lb - dist + da
        ans = max(ans, 1 + min(rb, ra) - lb)
        ans = max(ans, 1 + min(rb, ra + ta % (tb % ta)) - (la + ta % (tb % ta)))
    la, ra = lb - dist, lb - dist + da
    ans = max(ans, 1+min(rb, ra) - lb)
    ans = max(ans, 1+min(rb, ra+ta) - (la+ta))
    return ans

def main():
    la, ra, ta = [int(i) for i in input().split()]
    lb, rb, tb = [int(i) for i in input().split()]
    print(solve(la, ra, ta, lb, rb, tb))

main()


from sys import stdin, stdout
from math import sin, tan, cos, pi, atan2, sqrt, acos, atan, factorial

def gcd(a, b):
    if not b:
        return a
    else:
        return gcd(b, a % b)

def solution(la, ra, ta, lb, rb, tb):
    g = gcd(ta, tb)
    d = (lb - la) % g
    return min(ra - la + 1 - d, rb - lb + 1)

la, ra, ta = map(int, stdin.readline().split())
lb, rb, tb = map(int, stdin.readline().split())

ans = max(solution(la, ra, ta, lb, rb, tb), solution(lb, rb, tb, la, ra, ta))

ans = max(ans, 0)
sdout.write(str(ans))


n, m = map(int,raw_input().split())
if n >= 1 and m <= 100:
	if n == m and n%2 == 0:
		print "Malvika"
	elif n == m and n%2 != 0:
		print "Akshat"
	elif n != m and n%2 != 0 and m%2 != 0 :
		print "Akshat"
	elif n!= m and n%2 == 0 and m%2 == 0:
		print "Malvika"
	elif n == 1 or m == 1
		print "Akshat"
	else:
		print "Malvika"


n,m=(int(x) for x in input().split()
if min(n,m)%2==0:
    print("Malvika")
    else:

        print("akshat")


# -*- coding: utf-8 -*-
input1 = raw_input()
[row, col]=[int(x) for x in input1.split(" ")]
if (min(row,col)%2 == 0):
    print "Malvika"
else:
    print "Akshat"3


n,m=map(int,input().split())
flag=0
if(n==1 and m==2):
	print("Akshat")
	break
for i in range(1,(n*m)+1):
	if(i%2==0):
		flag=1
	else:
		flag=0
	i+=2
if(flag==1):
	print("Malvika")
else:
	print("Akshat")


n, b = map(int, raw_input().split())
end = []
res = []
last_end = -1
queue_size = 0
for i in range(n):
    t, d = map(int, raw_input().split())
    while end and t >= end[0]:
        end.pop(0)
        queue_size -= 1
    if last_end <= t:
        last_end = t+d
        res.append(last_end)
        end.append(last_end)
        queue_size += 1
    elif queue_size <= b:
        last_end = last_end+d
        res.append(last_end)
        end.append(last_end)
        queue_size += 1
    else:
        res.append(-1)
        end.append(-1)
print ' '.join(map(str, res))


n,m = [int(i) for i in input().split()]
if n%2 == 1:
    if m >= (n-1)/2:
        print (int((n-1)*n/2))
    else:
        t = 0
        for i in range((n-1)/2-m):
            t += 4*i+3
        print (int((n-1)*n/2-t))
else:
    if m >= n/2:
        print (int((n-1)*n/2))
    else:
        t = 0
        for i in range(n/2-m):
            t += 4*i+1
        print (int((n-1)*n/2-t))


(n, k) = map(int, raw_input().split())

aux = range(n)
reversed = False
for i in xrange(k):
	if i > n-i-1:
		reversed = True
		break
	tmp = aux[i]
	aux[i] = aux[n-i-1]
	aux[n-i-1] = tmp

if reversed:
	print n*(n-1)/2
else:
	out = 0
	for i in xrange(n):
		for j in xrange(i+1, n):
			if aux[i] > aux[j]:
				out += 1
	print out


 s, j, l = input(), -1, [-1]
for c in s:
    while j != -1 and c != s[j]:
        j = l[j]
    j += 1
    l.append(j)
le = l[-1]
if l.count(le) < 2:
    le = l[le]
print(s[:le] if le > 0 else "Just a legend")


n, k = (int(i) for i in input().split())
import math
def combinations(a,b):
    i = math.factorial(a)
    x = math.factorial(b)
    y = math.factorial(a-b)
    return i/(x*y)
if n == 1:
    print(0)
    exit()
if k >= int(n/2):
    t = combinations(n,2)
    print(int(t))
    exit()
s = n - 2 * k
p = combinations(s,2)
l = combinations(n,2)
output = l - p
print(int(output))


import sys
read=lambda:sys.stdin.readline().rstrip()
readi=lambda:int(sys.stdin.readline())
writeln=lambda x:sys.stdout.write(str(x)+"\n")
write=lambda x:sys.stdout.write(x)
'''
a - 한 변의 길이
x, y = 돌을 던진 곳의 위치

반드시 네모 안에 들어가야만 함
경계에 걸쳐도 -1

h = 5 (-a, 4a), (a, 5a)
h = 4 (-a/2, 3a), (a/2, 4a)
h = 3 (-a, 2a), (a, 3a)
h = 2 (-a/2, a) (-a/2, 2a)
h = 1 :(-a/2, 0) (a/2, 0)

h = 1
    (-a/2, 0),(a/2, 1*a)
h = 2K + 1 ( K = 1, 2, 3, ...)
    (-a, (h-1)*a), (a, h*a)
h = 2K
    (-a/2, h-1), (a/2, h)

ha - ha + a
'''
def solve(a,x,y):
    if not y % a:
        return -1
    if abs(x) >= a:
        return -1
    if y < a:
        if -a/2.0 < x < a/2.0:
            return 1
        else:
            return -1

    h = y // a
    if not h % 2:
        if x == 0:
            return -1
        if -a < x < 0:
            return 3*h//2
        if 0 < x < a:
            return (3*h//2) + 1
        else:
            return -1
    else:
        if -a/2.0 < x < a/2.0:
            return 3*((h+1)//2) - 1
        else:
            return -1

A,X,Y=map(int, read().split())
writeln(solve(A,X,Y))

'''
h = 1 2 3(h+1)/2 -1
h = 3 5
h = 5 8

h = 2 3 3(h//2)
h = 4 6
h = 6 9

'''


entrada = list(map(int,input().split(' ')))
l = entrada[0]
x = entrada[1]
y = entrada[2]

ok = True

res = 1

ax = True

if y >= l:
	y -= l
	res = 2

while(y >= l):
	if ax:
		res += 1
	else:
		res += 2
	ax = not ax

	y -= l

if y == 0:
	ok = False
if not ax:
	if x <= -l or x >= l or x == 0:
		ok = 0
	if x > 0:
		res += 1
else:
	if x => (l/2) or x <= -(l/2):
		ok = 0

if ok:
	print(res)
else:
	print(-1)


a,r,w=map(int,raw_input().split())
b=w%a
if -a<r<a and w%a>0:
	k=w/a
	k=k+min(1,b)
	if k==1:
		if -a/2.0<r<a/2.0:
			print 1
		else:
			print -1
	else:
		if (k%2==0):
            if (-a/2.0<r<a/2.0):
                b=(k/2-1)*2+k/2+1
                print b
            else:
                print -1
		elif k%2==1:
			b=k/2
			if -a<r<0:
				print (b*2+(k-b)-1)
			elif 0<r<a:
				print (b*2+(k-b))
			else:
				print -1
		else:
			print -1
else:
	print -1


class Square():
    point1 = []
    point2 = []
    number = 0

    def GenerateCords(self, a, x):
        self.number = x
        if x == 1:
            self.point1 = [(-a/2), 0]
        elif x%3 == 2:
            self.point1 = [(-a/2),((((x//3)*2)+1)*a)]
        elif x%3 == 0:
            self.point1 = [-a,(((((x//3)-1)*2)+2)*a)]
        else:
            self.point1 = [0,(((((x//3)-1)*2)+2)*a)]

        self.point2 = [(self.point1[0]+a),(self.point1[1]+a)]

    def CheckIfIn(self, x, y):
        if x < self.point1[0]+1 or x => self.point2[0]:
            return -1
        if y < self.point1[1]+1 or y => self.point2[1]:
            return -1
        else:
            return self.number

a,x,y = map(int, input().split())

row = y//a + 1

if row == 1:
    test = Square()
    test.GenerateCords(a, row)
elif (row - 1)%2 == 1:
    test = Square()
    test.GenerateCords(a, ((((row-1)//2)*3)+2))
else:
    if x <= 0:
        test = Square()
        test.GenerateCords(a, (row//2)*3)
    else:
        test = Square()
        test.GenerateCords(a, ((row//2)*3)+1)

print(test.CheckIfIn(x,y))


a,x,y = map(int,(input().strip().split()))

if(y<0 or y%a == 0):
    print(str(-1))
elif x>a or x< (-1*a):
    print(str(-1))
else:
    if(y>0 and y<a):
        if(x>(-1*a)/2 and x<a/2):
            print(str(1))
        else:
            print(str(-1))
    else:
        k = (y-a)//(2*a)
        yRem = (y-a) % (2*a)

        elif(yRem<a and yRem>0 and x>(-1*a)/2 and x<a/2):
            print(str(2 + 3*k))
        elif(yRem>a and yRem<2*a and x>0 and x<a):
            print(str(4+3*k))
        elif (yRem > a and yRem < 2 * a and x < 0 and x > (-1*a)):
            print(str(3+3*k))
        else:
            print(str(-1))


def f(s):
    return s==s[-1::-1]
a,b=input().split(':')
p,q=int(a),int(b)
c=0
while not f(a+b):
    temp=q+1//60
    q=(q+1)%60
    p=(p+temp)%24
    c+=1
    a,b=str(p),str(q)
    if len(a)==1:
        a='0'+a
    if len(b)==1:
        b='0'+b
print(c)


=input()
ch1=ch[0]+ch[1]
ch2=ch[3]+ch[4]
a=int(ch1)
b=int(ch2)
s=0
def pal(a,b):
    return (a==(b%10)*10+b//10)
if pal(a,b):
    print(0)
else:
    while pal(a,b)==False:
        s=s+1
        if b!=59 :
            b=b+1
        else :
            b=0
            if a!=23:
                a=a+1
            else :
                a=0

    print(s)


import sys

input = sys.stdin.readline

time = [int (x) for x in input().split(":")]

count = 0

while True:
    second = str(time[1])
    if (len(first) == 1 and second[0] == 0 and second[1] = first[0]):
        break
    if (len(second) == 1 and first[0] == 0 and first[1] = second[0]):
        break
    if str(time[0])[::-1] == second:
        break
    count += 1
    if time[1] < 59:
        time[1] += 1
    else:
        time[1] = 0
        if time[0] < 23:
            time[0] += 1
        else:
            time[0] = 0

print(count)


 n=int(input())
n=n+1
n=n*n
a=int(n/4)
print(a)


 n=int(input())
n=n+1
a=int(n*n/4)
print(a)


n=input()
dict={}
i=n
arr=[]
while(i>0):
    k=0
    for j in range(n-i+1):
        arr.append([i,k,k+i])
        k+=1
    i-=1

l=len(arr)
ans=0
for i in range(1,l):
    k=arr[i][0]
    l1=arr[i][1]
    l2=arr[i][2]
    if arr[i][0]!=-1:
        found=False
        for j in range(i+1,l):
            if arr[j][0]!=-1:
                p=arr[j][0]
                r1=arr[j][1]
                r2=arr[j][2]
                if k+p==n and (r1>=l2 or l1>=r2):
                    arr[j][0]=-1
                    ans+=1
                    found=True
                    break
                elif k+p<n and (r1>=l2 or l1>=r2):
                    p+=arr[j][0]
                    arr[j][0]=-1
        if found!=True:
            ans+=1

    #print arr,ans

print ans+1


def getans(n):
    if n == 2 :
        return 2
    if n == 3:
        return 4
    return n+getans(n-2)
print(getans(int(input())))


x=input().split()

d =int(x[0])
m =int(x[1])

b= max(d,m); s= min(d,m)

while(True):
    if (b%d==0 and b%m==0):
        c=b
        break
    b+=1

y = c/d
z = c/m

if d>m:
    y+=1
else:
    z+=1

if y>z:
    print("Dasha")

elif y<z:
    print("Masha")

else:
    print("Equal")


t = raw_input()
t = t.split(" ")
a = int(t[0])
b = int(t[1])
if(a-b==1 || b-a==1):
	print "Equal"
elif(a > b):
	print "Masha"
else:
	print "Dasha"


#!/usr/bin/env python

def gcd(a, b):
	return gcd(b, a%b) if b else a

a, b = map(int, input().split())
g = gcd(a, b)
a /= g
b /= g
if a - b == 1 or b - a == 1:
	print("Equal")
elif a < b:
	print("Dasha")
else:
	print("Masha")

return 0


#include <iostream>
using namespace std;

int gcd(int a,int b){
    if(b == 0){
        return a;
    }
    else{
        return gcd(b,a%b);
    }
}

int main(){
	int a;
	int b;
	cin >> a >> b;

	int aa = a / gcd(a, b);
	int bb = b / gcd(a, b);

	while (true){
		if(abs(aa-bb)==1){
			cout << "Eqular" << endl;
			break;
		}
		if(a < b){
			cout << "Dasha" << endl;
			break;
		}
		if(a > b){
			cout << "Masha" << endl;
			break;
		}
	}

}


def gcd(a,b):
  if b==0: return a
  else return gcd(b,a%b)
a,b=map(int,raw_input().split())
d=gcd(a,b)
a/=d
b/=d
if b==a+1 or b+1==a: print 'Equal'
if a>b: print 'Masha'
if a<b: print 'Dasha'


I=lambda:map(int, raw_input().split())

def isok(a,b,k):
    if a<=k<=b: return 0
    elif k<a: return -1
    else: return 1

def bs(a,b,c,d,x,y):
    ans=[0,0]
    while a<=b:
        mid=(a+b)/2
        ret=isok(c,d,mid*y/x)
        if ret==0: ans=[mid,mid*y/x];a+=1
        elif ret==-1: a+=1
        else: b-=1
    return ans
a,b,x,y=I()
a0,b0,a1,b1=0,0,0,0
a0,b0=bs(1,a,1,b,x,y)
a1,b1=bs(1,b,1,a,y,x)
if a0*b0<a1*b1: a0,b0=a1,b1
print a0,b0


def GCD(a, b):
	while a != b:
		if a > b:
			a = a - b
		else:
			b = b - a
	return a

a, b, x, y = map(int, raw_input().split())
gcd = GCD(x, y)
x/=gcd
y/=gcd
c = a/x

d = b/y

if c < d:
	r1 = x*c
	r2 = y*c
elif d <= c:
	r1 = x*d
	r2 = y*d
if r1*y == r2*x:
	print r1, r2
else:
	print 0, 0


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

width = int(input())
height = int(input())
x = int(input())
y = int(input())

n = x
m = y

while n != 0 and m != 0:
        if n > m:
                n = n % m
        else:
                m = m % n

n += m
x /= n
y /= n

w_new = 0
h_new = 0
bot = 1
top = 2e9

while (bot <= top):
        c = int((bot + top) / 2)
        if c * x <= width and c * y <= height:
                bot = c + 1
                w_new = c * x
                h_new = c * y
        else:
                top = c - 1

print(w_new)
print(" ")
print(h_new)


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

width = int(input())
height = int(input())
x = int(input())
y = int(input())

n = x
m = y

while n != 0 and m != 0:
        if n > m:
                n = n % m
        else:
                m = m % n

n += m
x /= n
y /= n

w_new = 0
h_new = 0
bot = 1
top = 2e9

while (bot <= top):
        c = int((bot + top) / 2)
        if c * x <= width and c * y <= height:
                bot = c + 1
                w_new = c * x
                h_new = c * y
        else:
                top = c - 1

print(str(w_new) + " " + str(h_new))


a,b,x,y = [int(x) for x in input().split()]

def gcd(r,s):
    if (r == 0 or s == 0):
        return r+s
    else:
        if r > s:
            return gcd(r-s,s)
        else:
            return gcd(r,s-r)

g = gcd(x,y)
x1 = int(x/g)
y1 = int(y/g)

if (x1 <= a and y1 <=b):
    c = 0
    while (x1*c <= a and y1*c<= b):
        c += 1
    print(x1*(c-1),y1*(c-1))
else:
    print(0,0)


n = int(input())
c = 1
for i in range(1, 20):
    tmp = (2**i - 1)*(2**(i-1))
    if (n % tmp) == 0:
    c = tmp
print(c)


#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <stack>
#include <list>
#include <cstring>
#include <set>
#include <climits>
#include <math.h>
#include <string>
#include <functional>
#include <numeric>

#define int long long
#define all(arr) begin(arr), end(arr)
#define pb push_back
#define em emplace_back

using namespace std;
signed main(){
    int n;
    cin>>n;
    vector<int> arr(n);
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    int pos=-1;
    for(int i=0;i<n-1;i++){
        if(arr[i]<arr[i+1]){
            pos=i+1;
        }
    }
    cout<<"first "<<pos<<endl;
    while(pos+1<n and arr[pos]==arr[pos+1]){
        pos++;
    }
    cout<<pos<<endl;
    for(int i=pos;i<n-1;i++){
        if(arr[pos]>arr[pos+1])continue;
        cout<<pos<<endl;
        cout<<"NO"<<endl;
        return 0;
    }
    cout<<"YES"<<endl;
}


import math
lista = []
def divisors(x):
    for i in range(1,int(math.sqrt(x))+1):
        if x%i == 0:
            lista.append(i)
            lista.append(x/i)
    lista.sort()
    lista.reverse()

    for j in range(len(lista)):
        k = ''
        a = -1
        b = 0
        k = str(bin(lista[j]))
        print k
        for v in range(len(k)):
            if k[v] == '0':
                a += 1
            if k[v] == '1':
                if a>0:
                    a = 0
                    b = 0
                    break
                else:
                    b+=1

        if b-a == 1: return lista[j]

x = int(input())
k = divisors(x)
print (k)
# 1512531319532


n=int(input())
x1=n
while x1 > 0:
    if n%x1==0:
        count=0
        x=x1
        while x%2==0:
            x=x/2
            count+=1
        g=1
        count1 = 0
        for  i in range(count):
            g=g*2+1
            count1 += 1
        if x==g:
            print(int(x*(2**count))
            x1=0
    x1-=1


import math

ans = 0
n = int(raw_input())
sq = int(math.sqrt(n))
pythagDict = {}
for x in range(1,sq+2):
    for y in range(1,x):
        a = 2*x*y
        b = x*x-y*y
        c = x*x+y*y
        pair = [min(a,b),max(a,b)]
        if c not in pythagDict and c <= n:
            pythagDict[c] = [pair]
            ans += 1
        elif c <= n:
            if pair not in pythagDict[c]:
                pythagDict[c].append(pair)
                ans += 1
for i in pythagDict:
    for pair in pythagDict[i]:
        for k in range(2,n/i):
            if k*i not in pythagDict:
                pythagDict[k*i] = [[pair[0]*k,pair[1]*k]]
                ans += 1
            elif [pair[0]*k,pair[1]*k] not in pythagDict[k*i]:
                pythagDict[k*i].append([pair[0]*k,pair[1]*k])
                ans += 1
print ans


import math

ans = 0
n = int(raw_input())
sq = int(math.sqrt(n))
pythagDict = {}
for x in range(1,sq+2):
    for y in range(1,x):
        a = 2*x*y
        b = x*x-y*y
        c = x*x+y*y
        pair = [min(a,b),max(a,b)]
        if c not in pythagDict and c <= n:
            pythagDict[c] = [pair]
            ans += 1
        elif c in pythagDict:
            if pair not in pythagDict[c]:
                pythagDict[c].append(pair)
                ans += 1
        else:
            pass
for i in pythagDict:
    for pair in pythagDict[i]:
        for k in range(2,1+n/i):
            if k*i not in pythagDict:
                pythagDict[k*i] = [[pair[0]*k,pair[1]*k]]
                ans += 1
            elif [pair[0]*k,pair[1]*k] not in pythagDict[k*i]:
                pythagDict[k*i].append([pair[0]*k,pair[1]*k])
                ans += 1
            else:
                pass
print ans


import math

n = int(raw_input())
sq = int(math.sqrt(n))
pythagList = []
for k in range(1,2+n/3):
    for x in range(1,sq+1):
        for nyin range(1,m):
            a = 2*k*m*n
            b = k*(m*m-n*n)
            c = k*(m*m+n*n)
            l = [a,b,c]
            l.sort()
            if l not in pythagList and c <= n:
                pythagList.append(l)
print len(pythagList)


#pragma comment(linker,"/STACK:100000000,100000000")

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <stack>
#include <cmath>
#include <map>
#include <stack>
#include <set>
#include <iomanip>
#include <queue>
#include <map>
#include <functional>
#include <memory.h>
#include <list>
#include <sstream>
#include <ctime>
#include <climits>
#include <bitset>
#include <list>

using namespace std;

/* Constants begin */
const long long inf = 1e18+7;
const long long mod = 1e9+7;
const double eps = 1e-9;
const double PI = 2*acos(0.0);
const double E = 2.71828;
/* Constants end */

/* Defines begin */
#define pb push_back
#define mp make_pair
#define ll long long
#define double long double
#define F first
#define S second
#define all(a) (a).begin(), (a).end()
#define forn(i,n) for (ll (i)=0;(i)<(ll)(n);(i)++)
/* Defines end */

ll gcd(ll x, ll y){
    return !y ? x : gcd(y,x%y);
}

int main(void) {
    #ifndef ONLINE_JUDGE
        freopen("input.txt","rt",stdin);
        freopen("output.txt","wt",stdout);
    #endif
    ll n, ans = 0;
    cin >> n;
    ll to = sqrt(n+.0);
    for(ll i=1;i<=to;i++)
     for(ll j=i;j<=to;j++){
      ll c = i*i+j*j;
      if(c > n) break;
      if(gcd(i,j) != 1 || ~(j-i) & 1) continue;
      ans += n/c;
     }
    cout << ans << endl;
    return 0;
}


import sys
import itertools as it
import bisect as bi
import math as mt
import collections as cc
input=sys.stdin.readline
I=lambda:list(map(int,input().split()))
n,m=I()
a=[]
b=[]
c=[]
for i in range(1,int(n**0.5)+1):
	if n%i==0:
		a.append(i)
for i in range(1,int(m**0.5)+1):
	if m%i==0:
		b.append(i)
ne=n+m
for i in range(1,int(ne**0.5)+1):
	if ne%i==0:
		c.append(i)
ans=10**9+7
for i in c[::-1]:
	j=ne//i
	tf=0
	for ii in a:
		if ii<=i and n//ii<=j:
			tf=1
			break
	for jj in b:
		if jj<=i and m//jj<=j:
			tf=1
			break
	if tf:
		ans=min(ans,2*(i+j))
		break
print(ans)


#coding:utf-8

a, b = map (int, raw_input ().split ())
c = a+b
ans = c*2+2

x, y = 1, a
index = 1
i = 2
while i*i <= c:
	if c%i == 0:
		while index <= i:
			if a%index == 0:
				x, y = index, a/index
			index += 1
		if x <= i and y <= c/i:
			ans = min (ans, 2*(i+c/i))
	i += 1

print ans


import sys,bisect as bi
input = sys.stdin.readline
I = lambda : list(map(int,input().split()))

def an(x,y):
	vd=[1,x]+([] if x%2 else [2,x//2])
	for i in range(3,int(x**0.5)+1,2):
		if x%i==0:
			vd.append(i)
			if i!=x//i:
				vd.append(x//i)
	vd.sort()
	an=4*x+4*y
	for i in range(len(dv)):
		cr=dv[i]
		p=bi.bisect(vd,cr)
		p-=1
		if (x+y)//cr>=x//vd[p]:
			an=min(an,2*(cr+(x+y)//cr))
	return an
a,b = I()
x=a+b
dv=[1,x]+([] if x%2 else [2,x//2])
ar=[1,2,3]
for i in range(3,int(x**0.5)+1,2):
	if x%i==0:
		dv.append(i)
		if i!=x//i:
			dv.append(x//i)
print(min(an(a,b),an(b,a)))


d_a = []
d_b = []

def solve(a, b):
    global d_a, d_b

    n = a + b
    ans = (1 + n) << 1

    for i in xrange(1, int(n ** 0.5) + 1):
        if n % i == 0:
            j = 0
            while j < len(d_a) and d_a[j] <= i:
                if (a // d_a[j] <= n // i):
                    ans = min(ans, (i + n // i) << 1)
                j += 1

    for i in xrange(1, int(n ** 0.5) + 1):
        if n % i == 0:
            j = 0
            while j < len(d_b) and d_b[j] <= i:
                if (b // d_b[j] <= n // i):
                    ans = min(ans, (i + n // i) << 1)
                j += 1

    return ans

a, b = map(int, raw_input().strip().split())

for i in xrange(1, int(a ** 0.5) + 1):
    if a % i == 0: d_a.append(i)
for i in xrange(1, int(b ** 0.5) + 1):
    if b % i == 0: d_b.append(i)

print solve(a, b)


import sys
import itertools as it
import bisect as bi
import math as mt
import collections as cc
input=sys.stdin.readline
I=lambda:list(map(int,input().split()))
n,m=I()
a=[]
b=[]
c=[]
for i in range(1,int(n**0.5)+1):
	if n%i==0:
		a.append(i)
for i in range(1,int(m**0.5)+1):
	if m%i==0:
		b.append(i)
ne=n+m
for i in range(1,int(ne**0.5)+1):
	if ne%i==0:
		c.append(i)
ans=10**9+7
for i in c:
	j=ne//i
	tf=0
	for ii in a:
		if ii<=i and n//ii<=j:
			tf=1
			break
	for jj in b:
		if jj<=i and m//jj<=j:
			tf=1
			break
	if tf:
		ans=min(ans,2*(i+j))
print(ans)


def main():
    n, m = map(int, input().split(' '))
    if (n % 2 == 0) and (m % 2 == 0):
        if (n == 2) and (m == 2):
            print(0)
        else:
            print(m*n)
    else:
        if (n % 2 == 1) and (m % 2 == 1):
            if (n == 1) and (m == 1):
                print(0)
            elif (n == 1) and (m % 6 == 3):
                print(m - 3)
            elif (n % 6 == 3) and (m == 1):
                print(n - 3)
            else:
                print(m*n - 1)
        else:
            if (n == 1) or (m == 1):
                if (n % 6 == 0) or (m % 6 == 0):
                    print(m*n)
                else:
                    print(m*n - 2)
            elif (n == 2) or (m == 2):
                if (n in [3, 7]) or (m in [3, 7]):
                    print(m*n - 2)
                else:
                    print(m*n)
            else:
                print(m*n)

if __name__ == '__main__':
    main()


n, m = map(int, input().split())
if n > m:
  n, m = m, n
if n == 1:
  print(m // 6 + (m + 1) // 6 + (m + 2) // 6 << 1)
elif n == 2:
  print(0 if m == 2 else 4 if m == 3 12 if m == 7 else n * m)
else:
  print(n * m >> 1 << 1)


n,m=map(int,input().split(" "))
if n*m<6:
    print(0)

elif n*m==6:
    print(4)
elif (n==2 and m%2==1) or (m==2 and n%2==1):
    print(n*m-2)
elif((n==2 and m%2==0) or (m==2 and n%2==0))
    print(n*m)
else:
    print(n*m-(n*m)%2)


n = int(input.split())
ll = [int(x) for x in input().split()]

count = 0

idx = -1
for i in ll:
    idx = idx + 1

    if i == 1:
        count += 1

    if (idx > 0) and (idx < len(ll)-1):
        if ll[idx-1] == 1 and ll[idx] == 0 and ll[idx+1] == 1:
            count += 1

print(count)


n = map(int, input().split())
ll = [int(x) for x in input().split()]

count = 0

idx = -1
for i in ll:
    idx = idx + 1

    if i == 1:
        count += 1

    if (idx > 0) and (idx < len(ll)-1):
        if ll[idx-1] == 1 and ll[idx] == 0 and ll[idx+1] == 1:
            count += 1

print(count)


import sys
from sys import stdin, stdout
n = int(input())
ll = [int(x) for x in stdin.readline().rstrip().split()]

count = 0

idx = -1
for i in ll:
    idx = idx + 1

    if i == 1:
        count += 1

    if (idx > 0) and (idx < len(ll)-1):
        if ll[idx-1] == 1 and ll[idx] == 0 and ll[idx+1] == 1:
            count += 1

stdout.write(str(count)+"\n")


n = int(raw_input())
a = map(int, raw_input().split())

s = 0
for i in xrange(n):
    if a[i] == 1:
        s += 1
    elif a[i] == 0 and (i > 0 and i + 1 < n and a[i-1] == 1 and a[i+1] == 1):
        s += 1

print s


from sys import stdin, stdout
n = map(int, input().split())
ll = [int(x) for x in stdin.readline().rstrip().split()]

count = 0

idx = -1
for i in ll:
    idx = idx + 1

    if i == 1:
        count += 1

    if (idx > 0) and (idx < len(ll)-1):
        if ll[idx-1] == 1 and ll[idx] == 0 and ll[idx+1] == 1:
            count += 1

stdout.write(str(count)+"\n")


k = input()
q = input()
ans = []
cur = ""
used = set()
for i in range(len(q)):
	if q[i] not in used:
		if len(cur) > 0:
			ans.append(cur)
 		cur = ""
		cur += q[i]
		used.add(q[i])
	else:
		cur += q[i]
ans.append(cur)
if len(ans) < k:
	print("NO")
else:
	print("YES")
	for i in range(k, len(ans)):
		ans[k - 1] += ans[i]
	for i in range(k):
		print(ans[i])


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
public class Codeforces
{
    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
        reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);
        writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);
        var n = ReadInt();
        var bak = n;
        var s = ReadToken();
        var ans = new string[100];
        int ind = 0;
        var alpha = Enumerable.Repeat(1, 26).ToArray();
        for (int i = 0; i < s.Length - 1; i++)
        {
            int j = i;
            if (s[i] != s[i + 1] && alpha[s[i] - 'a'] > 0)
            {
                if (n == 1)
                {
                    ans[ind] = s.Substring(j);
                }
                else
                {
                    ans[ind++] = s[i].ToString();
                }
                alpha[s[i] - 'a']--;
                n--;
            }
            else
            {
                for (j = i + 2; j < s.Length; j++)
                {
                    if (s[i] != s[j] && alpha[s[i] - 'a'] > 0)
                    {
                        if (n == 1)
                        {
                            ans[ind] = s.Substring(j);
                        }
                        else
                        {
                            ans[ind++] = s.Substring(i, j - i);
                        }
                        alpha[s[i] - 'a']--;
                        n--;
                        i = j - 1;
                        break;
                    }
                }
            }
            if (n == 0)
            {
                Console.WriteLine("YES");
                for (int k = 0; k < bak; k++)
                {
                    Console.WriteLine(ans[k]);
                }
                return;
            }
        }
        Console.WriteLine("NO");
        reader.Close();
        writer.Close();
    }
    #region Read / Write

    private static Queue<string> currentLineTokens = new Queue<string>();

    private static string[] ReadAndSplitLine()
    {
        return reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public static string ReadToken()
    {
        while (currentLineTokens.Count == 0)
            currentLineTokens = new Queue<string>(ReadAndSplitLine());
        return currentLineTokens.Dequeue();
    }

    public static int ReadInt()
    {
        return int.Parse(ReadToken());
    }

    public static long ReadLong()
    {
        return long.Parse(ReadToken());
    }

    public static double ReadDouble()
    {
        return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
    }

    public static int[] ReadIntArray()
    {
        return ReadAndSplitLine().Select(int.Parse).ToArray();
    }

    public static long[] ReadLongArray()
    {
        return ReadAndSplitLine().Select(long.Parse).ToArray();
    }

    public static double[] ReadDoubleArray()
    {
        return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
    }
    public static int[][] ReadIntMatrix(int numberOfRows)
    {
        int[][] matrix = new int[numberOfRows][];
        for (int i = 0; i < numberOfRows; i++)
            matrix[i] = ReadIntArray();
        return matrix;
    }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows);
        int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = new int[numberOfRows];
            for (int j = 0; j < numberOfRows; j++)
                ret[i][j] = matrix[j][i];
        }
        return ret;
    }

    public static string[] ReadLines(int quantity)
    {
        string[] lines = new string[quantity];
        for (int i = 0; i < quantity; i++)
            lines[i] = reader.ReadLine().Trim();
        return lines;
    }
    public static void WriteArray<T>(IEnumerable<T> array)
    {
        writer.WriteLine(string.Join(" ", array));
    }

    public static void Write<T>(params T[] array)
    {
        WriteArray(array);
    }

    public static void WriteLines<T>(IEnumerable<T> array)
    {
        foreach (var a in array)
            writer.WriteLine(a);
    }
    #endregion
}


n = int(input())
s = input()
if (n > len(s)):
    print('NO')
else:
    print('YES')
    for i in range(n - 1):
        print(s[i])
    print(s[i + 1:])


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

"""
created by huash06 at 2015-05-18 15:10
"""
__author__ = 'huash06'

import sys
import os
import datetime
import functools
import itertools
import collections

def findBeautifulStr(astr, index, pres, firsts, n):
    if index >= len(astr):
        if n == len(pres):
            return pres
        else:
            return []
    if len(astr) - index < n - len(pres):
        return []

    if astr[index] in firsts:
        return []

    if n == len(pres) + 1:
        return pres + [astr[index:]]
    for i in range(index+1, len(astr)-(n-len(pres))+1):
        res = findBeautifulStr(astr, i, pres + [astr[index:i]], firsts.union(astr[index]), n)
        if res:
            return res
    return []

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

res = findBeautifulStr(S, 0, [], set(), N)
if res:
    print('YES')
    for seg in res:
        print(seg)
else:
    print('NO')


def DFS(depth, start, str, used):
    if start >= len(str):
        return None
    if str[start] in used:
        return None
    if depth == 1:
        return [str[start:]]
    for i in range(start, len(str)):
        res = DFS(depth - 1, i + 1, str, used + str[start])
        if res != None:
            return res + [str[start:i+1]]
    return None

def main():
    k = int(input())
    str = input()
    res = DFS(k, 0, str, "")
    if res == None:
        print("NO")
    else:
        print("YES")
        res.reverse()
        for token in res:
            print(token)

if __name__ == '__main__':
    main()


import string

class Position:
  def __init__(self, r, c):
    self.r = r
    self.c = c

def s_to_position(s):
  letter, number = s[0], s[1]
  return Position(string.ascii_letters.index(letter), int(number) - 1)

def finish(message):
  print(message)
  import sys; sys.exit()

def king_attacks(attacker, defender):
  for dr in range(-1, 2):
    r = attacker.r + dr
    for dc in range(-1, 2):
      c = attacker.c + dc
      if r == defender.r and c == defender.c:
        return True
  return False

def rook_attacks(attacker, defender, blockers=[]):
  if attacker.r == defender.r and attacker.c == defender.c:
    return False
  if attacker.r == defender.r:
    blocked = False
    for blocker in blockers:
      if blocker.r == attacker.r:
        if attacker.c < blocker.c and blocker.c < defender.c:
          blocked = True
        if defender.c < blocker.c and blocker.c < attacker.c:
          blocked = True
    if not blocked:
      return True
  if attacker.c == defender.c:
    blocked = False
    for blocker in blockers:
      if blocker.c == attacker.c:
        if attacker.r < blocker.r and blocker.r < defender.r:
          blocked = True
        if defender.r < blocker.r and blocker.r < attacker.r:
          blocked = True
    if not blocked:
      return True
  return False

rook_a, rook_b, king_white, king_black = map(s_to_position, input().split())

for dr in range(-1, 2):
  r = king_black.r + dr
  for dc in range(-1, 2):
    c = king_black.c + dc
    if r < 0 or r > 7 or c < 0 or c > 7:
      continue
    current_king = Position(r, c)
    if king_attacks(king_white, current_king):
      #print('king attacks %d, %d' % (r, c))
      continue
    if rook_attacks(rook_a, current_king, [king_white]):
      #print('rook A attacks %d, %d' % (r, c))
      continue
    if rook_attacks(rook_b, current_king, [king_white]):
      #print('rook B attacks %d, %d' % (r, c))
      continue
    #print('%d, %d is safe' % (r, c))
    finish('OTHER')

finish('CHECKMATE')


pos = input().split()
ranks = 'abcdefgh'
intPos = []
for piece in pos:
    intPos.append([ranks.index(piece[0]),int(piece[1])-1])

guarded = []
shift = 1
while intPos[0][0] + shift < 8:
    square = [intPos[0][0]+shift,intPos[0][1]]
    if square == intPos[2]:
        break
    guarded.append(square)
    shift += 1

shift = -1
while intPos[0][0] + shift >= 0:
    square = [intPos[0][0]+shift,intPos[0][1]]
    if square == intPos[2]:
        break
    guarded.append(square)
    shift -= 1

shift = 1
while intPos[1][0] + shift < 8:
    square = [intPos[1][0]+shift,intPos[1][1]]
    if square == intPos[2]:
        break
    guarded.append(square)
    shift += 1

shift = -1
while intPos[1][0] + shift >= 0:
    square = [intPos[1][0]+shift,intPos[1][1]]
    if square == intPos[2]:
        break
    guarded.append(square)
    shift -= 1

shift = 1
while intPos[0][1] + shift < 8:
    square = [intPos[0][0],intPos[0][1]+shift]
    if square == intPos[2]:
        break
    guarded.append(square)
    shift += 1

shift = -1
while intPos[0][1] + shift >= 0:
    square = [intPos[0][0],intPos[0][1]+shift]
    if square == intPos[2]:
        break
    guarded.append(square)
    shift -= 1

shift = 1
while intPos[1][1] + shift < 8:
    square = [intPos[1][0],intPos[1][1]+shift]
    if square == intPos[2]:
        break
    guarded.append(square)
    shift += 1

shift = -1
while intPos[1][1] + shift >= 0:
    square = [intPos[1][0],intPos[1][1]+shift]
    if square == intPos[2]:
        break
    guarded.append(square)
    shift -= 1

for x in range(-1,2):
    for y in range(-1,2):
        square = [intPos[2][0]+x,intPos[2][1]+y]
        guarded.append(square)

mate = True
for x in range(-1,2):
    for y in range(-1,2):
        square = [intPos[3][0]+x,intPos[3][1]+y]
        if square[0] < 8 and square[0] >= 0:
            if square[1] < 8 and square[1] >= 0:
                if square not in guarded:
                    mate = False

if mate:
    print("CHECKMATE")
else:
    print("OTHER")


#!/usr/bin/python
# coding=utf-8

def inboard(x, y):
	return x >= 1 and x <= 8 and y >= 1 and y <= 8

direction = [ [ 0, 0],
		[ 1, 0],
		[ 0, 1],
		[-1, 0],
		[ 0,-1],

		[ 1, 1],
		[ 1,-1],
		[-1, 1],
		[-1,-1]]

def reach(x, y, dx, dy):
	global g
	x += dx
	y += dy
	while inboard(x,y):
		if g[x][y] > 0:
			if g[x][y] == ME:
				return True
			else:
				return False
		x += dx
		y += dy
	return False

def judge():
	global g
	for i in range(1, 9):
		for j in range(1, 9):
			if g[i][j] == ROOK:
				if reach(i, j, 0, 1): return False
				if reach(i, j, 0,-1): return False
				if reach(i, j, 1, 0): return False
				if reach(i, j,-1, 0): return False
			if g[i][j] == KING:
				for dx, dy in direction:
					#print "dx = %d, dy = %d" % (dx, dy)
					if inboard(i + dx, j + dy) and g[i + dx][j + dy] == ME:
						return False
	return True

g = [[0 for i in range(0, 9)] for i in range(0, 9)]

ROOK = 1
KING = 2
ME   = 3

chess = raw_input().strip().split(" ")
chess =[[ord(chess[0][0]) - ord('a') + 1, ord(chess[0][1]) - ord('0')],
		[ord(chess[1][0]) - ord('a') + 1, ord(chess[1][1]) - ord('0')],
		[ord(chess[2][0]) - ord('a') + 1, ord(chess[2][1]) - ord('0')],
		[ord(chess[3][0]) - ord('a') + 1, ord(chess[3][1]) - ord('0')]]
g[chess[0][0]][chess[0][1]] = ROOK;
g[chess[1][0]][chess[1][1]] = ROOK;
g[chess[2][0]][chess[2][1]] = KING;

#for i in range(1, 9): print g[i]

ok = True
for dx,dy in direction:
	x = chess[3][0] + dx
	y = chess[3][1] + dy
	#print "dx = %3d, dy = %3d" % (dx, dy)
	if inboard(x, y) and g[x][y] != KING:
		prev = g[x][y]
		g[x][y] = ME
		if judge():
			ok = False
			#for i in range(1, 9): print g[i]
			#print ""
		g[x][y] = prev

if ok:
	print "CHECKMATE"
else:
	print "OTHER"


import sys

def iswin(r1,r2,wk,bk):
  m = False

  if r1 == bk or r2 == bk:
    return False

  #if wk == bk:
  #  return True

  #print r1, r2, wk, bk
  if r1[:1]==bk[:1]:
    lb = min(r1[1:],bk[1:])
    ub = max(r1[1:],bk[1:])
    if (r2[:1] != r1[:1] or r2[1:] < lb or r2[1:] > ub) and \
        (wk[:1] != r1[:1] or wk[1:] < lb or wk[1:] > ub):
      m = True

  if r1[1:]==bk[1:]:
    lb = min(r1[:1],bk[:1])
    ub = max(r1[:1],bk[:1])
    if (r2[1:] != r1[1:] or r2[:1] < lb or r2[:1] > ub) and \
        (wk[1:] != r1[1:] or wk[:1] < lb or wk[:1] > ub):
      m = True

  if r2[:1]==bk[:1]:
    lb = min(r2[1:],bk[1:])
    ub = max(r2[1:],bk[1:])

if (r1[:1] != r2[:1] or r1[1:] < lb or r1[1:] > ub) and \
        (wk[:1] != r2[:1] or wk[1:] < lb or wk[1:] > ub):
      m = True

  if r2[1:]==bk[1:]:
    lb = min(r2[:1],bk[:1])
    ub = max(r2[:1],bk[:1])
    if (r1[1:] != r2[1:] or r1[:1] < lb or r1[:1] > ub) and \
        (wk[1:] != r2[1:] or wk[:1] < lb or wk[:1] > ub):
      m = True

  x1,y1 = map(ord,wk)
  x2,y2 = map(ord,bk)

  if abs(x1-x2)<=1 and abs(y1-y2)<=1:
    m = True

  return m

r1, r2, wk, bk = sys.stdin.readline().strip().split(' ')
mate = True

if iswin(r1,r2,wk,bk)==False:
  mate = False

if bk[:1] >'a':
  nbk = chr(ord(bk[:1])-1) + bk[1:]
  if iswin(r1,r2,wk,nbk) == False:
    mate = False

if bk[:1] < 'h':
  nbk = chr(ord(bk[:1])+1) + bk[1:]
  if iswin(r1,r2,wk,nbk) == False:
    mate = False

if bk[1:] > '1':
  nbk = bk[:1] + chr(ord(bk[1:])-1)
  if iswin(r1,r2,wk,nbk) == False:
    mate = False

if bk[1:] < '8':
  nbk = bk[:1] + chr(ord(bk[1:])+1)
  if iswin(r1,r2,wk,nbk) == False:
    mate = False

if bk[:1] > 'a' and bk[1:] > '1':
  nbk = chr(ord(bk[:1])-1) + chr(ord(bk[1:])-1)
  if iswin(r1,r2,wk,nbk) == False:
    mate = False

if bk[:1] > 'a' and bk[1:] < '8':
  nbk = chr(ord(bk[:1])-1) + chr(ord(bk[1:])+1)
  if iswin(r1,r2,wk,nbk) == False:
    mate = False

if bk[:1] < 'h'and bk[1:] > '1':
  nbk = chr(ord(bk[:1])+1) + chr(ord(bk[1:])-1)
  if iswin(r1,r2,wk,nbk) == False:
    mate = False

if bk[:1] < 'h' and bk[1:] < '8':
  nbk = chr(ord(bk[:1])+1) + chr(ord(bk[1:])+1)
  if iswin(r1,r2,wk,nbk) == False:
    mate = False

if mate:
  print 'CHECKMATE'
else:
  print 'OTHER'


import sys

desired = 'BERLAND'
matches = 5

def check(x, y):
      global result, played, victim
      standing = played.keys()
      for i in range(4):
            points = 0
            team = standing[i]
            got, lost = 0, 0
            for j in range(5):
                  if result[j][1] == team:
                        result[j][0], result[j][1] = result[j][1], result[j][0]
                        result[j][2][0], result[j][2][1] = result[j][2][1], result[j][2][0]
                  if result[j][0] != team:
                        continue
                  diff = result[j][2][0] - result[j][2][1]
                  got += result[j][2][0]
                  lost += result[j][2][1]
                  if diff == 0: points += 1
                  if diff > 0: points += 3
            if team == desired:
                  points += 3
                  got += x
                  lost += y
            if team == victim:
                  got += y
                  lost += x
            standing[i] = (-points, -(got - lost), -got, team)
      standing = sorted(standing)
      return standing[0][3] == desired or standing[1][3] == desired

def add(s):
      global played
      if played.has_key(s):
            played[s] += 1
      else:
            played[s] = 1

result = []
played = dict()
for _ in range(matches):
      buf = raw_input().split()
      add(buf[0])
      add(buf[1])
      buf[2] = list(map(int, buf[2].split(':')))
      result.append(buf)
for pair in played.items():
      if pair[1] == 2 and pair[0] != desired:
            victim = pair[0]
for delta in range(1, 100):
      for x in range(delta, 100):
            y = x - delta
            if check(x, y):
                  print str(x) + ':' + str(y)
                  sys.exit(0)
print 'IMPOSSIBLE'


teams={}
for _ in range(5):
    t1,t2,scores=raw_input().split()
    s1,s2=map(int,scores.split(':'))
    teams[t1]=teams.get(t1) or [0,0,0,t1,0]
    teams[t2]=teams.get(t2) or [0,0,0,t2,0]
    if s1>s2:
        teams[t1][0]-=3
    elif s1<s2:
        teams[t2][0]-=3
    else:
        teams[t1][0]-=1
        teams[t2][0]-=1
    teams[t1][1]-=s1-s2
    teams[t2][1]-=s2-s1
    teams[t1][2]-=s1
    teams[t2][2]-=s2
    teams[t1][4]+=1
    teams[t2][4]+=1
oppo=[t[3] for t in teams.values() if t[3]!='BERLAND' and t[4]<3][0]
for xy in range(1,123):
    for y in range(0,123):
        t1,t2=teams['BERLAND'][:],teams[oppo][:]
        t1[0]-=3
        t1[1]-=xy
        t2[1]+=xy
        t1[2]-=y+xy
        t2[2]-=y
        t1[4]+=1
        t2[4]+=1
        tms=[t for t in teams.values() if t[4]>2]+[t1,t2]
        tms.sort()
        if tms[0][3]=='BERLAND' or tms[1][3]=='BERLAND':
            print '%d:%d'%(y+xy,y)
            exit()
print 'IMPOSSIBLE'


Teams = ["BERLAND"]
def teamn(name)
  Teams << name if Teams.index(name).nil?
  Teams.index(name)
end
game = [1,0,0,0]
point = [3,0,0,0]
diff = [0,0,0,0]
earn = [0,0,0,0]
5.times do |i|
  input = gets.split(" ")
  teama = teamn(input[0])
  teamb = teamn(input[1])
  score = input[2].split(":").map{|x| x.to_i}
  if score[0]>score[1]
    point[teama] += 3
  elsif score[0]==score[1]
    point[teama] += 1
    point[teamb] += 1
  else
    point[teamb] += 3
  end
  game[teama] += 1
  game[teamb] += 1
  diff[teama] += score[0] - score[1]
  diff[teamb] += score[1] - score[0]
  earn[teama] += score[0]
  earn[teamb] += score[1]
end
opponent = game.index(2)
found = false
fi = nil
fj = nil
1.upto(50) do |i|
  diff[0] += i
  diff[opponent] -= i
  i.upto(50) do |j|
    earn[0] += j
    earn[opponent] += j-i
    rank = (0..3).sort{|a,b| (point[a]<=>point[b])*8+(diff[a]<=>diff[b])*4+(earn[a]<=>earn[b])*2-(Teams[a]<=>Teams[b])}.index(0)
    if rank > 1
      found = true
      fj = j
      break
    end
    earn[0] -= j
    earn[opponent] -= j-i
  end
  if found
    fi = i
    break
  end
  diff[0] -= i
  diff[opponent] += i
end
if found
  puts fj.to_s+":"+(fj-fi).to_s
else
  puts "IMPOSSIBLE"
end


def _cmp(x, y):
    c = -cmp(x[1][0], y[1][0])
    d = -cmp(x[1][1]-x[1][2], y[1][1]-y[1][2])
    e = -cmp(x[1][1], y[1][1])
    f = cmp(x[0][0], y[0][0])
    if c != 0:
        return c
    elif d != 0:
        return d
    elif e != 0:
        return e
    else:
        return f

results = {}
for i in range(5):
    a, b, pts = raw_input().split()
    x, y = [int(i) for i in pts.split(':')]
    at = results[a] = results.get(a, [0, 0, 0])
    at[0], at[1], at[2] = (at[0]+(3 if x > y else 1 if x == y else 0), at[1]+x, at[2]+y)
    bt = results[b] = results.get(b, [0, 0, 0])
    bt[0], bt[1], bt[2] = (bt[0]+(3 if x < y else 1 if x == y else 0), bt[1]+y, bt[2]+x)

b = tuple(results['BERLAND'])
c = tuple(results['CERLAND'])
del results['BERLAND']
del results['CERLAND']
results = list(results.items())

(x, y) = (10, -1)

for i in xrange(10):
    for j in xrange(i):
        res = results[:]
        res.append(('BERLAND', (b[0]+3, b[1]+i, b[2]+j)))
        res.append(('CERLAND', (c[0], c[1]+j, c[2]+i)))
        res.sort(_cmp)
        barland = None
        if res[0][0] == 'BERLAND':
            barland = res[0][1]
        elif res[1][0] == 'BERLAND':
            barland = res[1][1]
        if barland and i-j < x - y:
            (x, y) = i, j

if x == 10 and y == -1:
    print 'IMPOSSIBLE'
else:
    print '{0}:{1}'.format(x, y)


from math import factorial
cat = [1, 1]
p = 10**9 + 7
n = int(input())
for i in range(1, 4000):
    cat.append((cat[-1]*2*(2*i + 1)//(i + 2)) % p)

ans = 0
for i in range(1, n + 1):
    ans += ((((factorial(n))//((factorial(i))*(factorial(n - i)))) % p)  *cat[n - i]) % p
print(ans)


n = int(input())
numbers = set()
nn = ""
for _ in range(n):
    a = int(input())
    numbers.add(a)
    nn += str(a)
first = nn.count(str(numbers.pop()))
second = nn.count(str(numbers.pop()))
if len(numbers) != 2 or first != second:
    print("NO")
else:
    print("YES")
    print(*numbers


def same(d):
    s=set()
    for i in d.keys():
        s.add(d[i])
    if len(s)==1:
        return True
    else:
        return False
n=input()
d={}
for i in range(n):
    t=input()
    if t in d.keys():
        d[t]+=1
    else:
        d[t]=1
if len(d)==2 and same(d):
    print("YES")
    for i in d.keys():
        print(i,end=" ")
else:
    print("NO")


num = int(input())
d = {}
a = []
for _ in range(num):
    card = int(input())
    if card not in d:
        d[card] = 1
        a.append(card)
    else:
        d[card] = d[card]+1

if len(d) == 2 and d[a[0]]=d[a[1]]:
    print("YES")
    print(a[0],a[1])
else:
    print("NO")


a=int(input())
b=[]
c=[]
for i in range(a):
    b.append(int(input()))
c=list(set(b))
d=[0 for i in range(len(c))]
for i in range(len(c)):
    for j in range(len(b)):
        if c[i]==b[j]:
            d[i] +=1
n=0
e=[]
for i in range(len(c)):
    for j in range(len(c)):
        if i==j:
            continue
        if d[i]==d[j]:
            e.append((c[i],c[j]))
            n+=1

f=list(set(e))
if  n==2 && f[0]==f[-1]:
    print("YES")
    for i in range(int(len(f)/2)):
        print(f[i][0],f[i][1])
else :
    print("NO")
####################


n=int(input())
for i in range(0,n):
      a=input()
      s=list(set(a))
if(len(s)==2 and a.count(s[0]==a.count[s[1])):
      print("YES")
      print(s[0],s[1])
else:
      print("NO")


import numpy as np
n,k = map(int,input().split(' '))
count=0
f=0
factors=[]
for i in range(2,n):
    while(count !=k-1 and n%i==0):
        count +=1
        factors.append(i)
        n=n//i
    factors.append(n)
    if(count ==k-1):
        f=1
        break

if(f == 1 ):

    print(*factors,sep=' ')
else:
    print(-1)


n,k = map(int,input().split(' '))
count=0
f=0
factors=[]
for i in range(2,n):
    while(count !=k-1 and n%i==0):
        count +=1
        factors.append(i)
        n=n//i

    if(count ==k-1):
        factors.append(n)
        f=1
        break

if(f == 1 ):
    print(*factors,sep=' ')
else:
    print(-1


def solve(n, k):
    if k==1:
        print(n)
        return

    sol = []
    for i in range(2,n):
        while n%i==0:
            sol.append(i)
            k-=1
            n = n//i
            if k!=1
                continue

            if n==1:
                print(-1)
                return
            else:
                sol.append(n)
                print(*sol)
                return

    return

def main():
    n,k = map(int,input().split(' '))
    solve(n,k)

if __name__ == '__main__':
    main()


n, k = [int(x) for x input().split()]
# list comprahension
cnt = 0
p = 2
V = []

while p<=n:
  if n%p==0:
    n = n // p
    cnt += 1
    V.append(p)
    if cnt==k:
      break
  else:
    p += 1

if cnt==k and n>1:
  V[cnt-1] *= n

if cnt<k:
  print(-1)
else
  for i in range(0, k):
    print(V[i], end=' ')


n, k = [int(x) for x in input().split]
p = 2
V = []
cnt = 0 #rozmiar listy czynników pierwszych

while p<=n:
  if n%p==0:
    n = n // p
    cnt += 1
    V.append(p)
    if cnt==k:
      break
    else:
    p += 1

if cnt==k and n>1:
 V[cnt-1] *= n
if cnt<k:
  print(-1)
else:
  for p in V:
    print(p, end=' ')


#素数集合
# 任何一个数字可以表示为2^(p1) * 3^(p2) * ... * k^(pn)
# 其因子个数总数为 (p1 + 1) * (p2 + 1) * ... * (pn + 1)
prime = [0, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29]

# 到每个节点有传到该节点的值和因子总数、以及该取第几个元素
min_value = round(1e18)
n = int(input())

def search(value, total_factor, i):
    global min_value
    if total_factor == n:
        min_value = min(value, min_value)
        return
    for k in range(1, 65):
        value *= prime[i]
        if value > min_value:
            break
        if total_factor * (k + 1) <= n:
            search(value, total_factor * (k + 1), i+1)

search(1, 1, 1)
print(min_value)


#include <iostream>
#include <tuple>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>

#define xrange(i, a, b)   for(int i=(a); ((a)<(b))?i<=(b):i>=(b); ((a)<(b))?++i: --i)

const int INF = 1e9;
using namespace std;

typedef long double ld;

ld dp[1024][12];

int main() {

   	ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;

#ifdef LOCAL_DEFINE
    freopen("in", "rt", stdin);
#endif

    // solution Here

    int n; cin >> n;
    int primes[15] = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29];

    xrange(i, 2, 1024 - 1){
    	xrange(j, 1, 12 - 1){
    		dp[1][j] = 1;
    		dp[i][j] = 1e22;
    	}
    }

    xrange(i, 2, 1002){

    	xrange(j, 0, 9){

    		xrange(k, 0, 18){

    			if(i % (k+1) != 0) continue;

    			dp[i][j] = min(dp[i][j], dp[i / (k+1)][j-1])
    		}
    	}
    }

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif

    return 0;
}


# -*- coding: utf-8 -*-
"""
Created on Tue Sep  4 00:25:14 2018

@author: lenovo
"""

#素数集合
# 任何一个数字可以表示为2^(p1) * 3^(p2) * ... * k^(pn)
# 其因子个数总数为 (p1 + 1) * (p2 + 1) * ... * (pn + 1)
prime = [0, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29]

# 到每个节点有传到该节点的值和因子总数、以及该取第几个元素
min_value = round(1e18)
n = int(input())

def search(value, total_factor, i):
    global min_value
    if total_factor == n:
        min_value = min(value, min_value)
        return
    for k in range(1, 65):
        value *= prime[i]
        if value > min_value:
            break
        if total_factor * (k + 1) <= n:
            search(value, total_factor * (k + 1), i+1)

search(1, 1, 1)
print(min_value)


"""
Created on Tue Sep  4 00:25:14 2018

@author: lenovo
"""

#素数集合
# 任何一个数字可以表示为2^(p1) * 3^(p2) * ... * k^(pn)
# 其因子个数总数为 (p1 + 1) * (p2 + 1) * ... * (pn + 1)
prime = [0, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29]

# 到每个节点有传到该节点的值和因子总数、以及该取第几个元素
min_value = round(1e18)
n = int(input())

def search(value, total_factor, i):
    global min_value
    if total_factor == n:
        min_value = min(value, min_value)
        return
    for k in range(1, 65):
        value *= prime[i]
        if value > min_value:
            break
        if total_factor * (k + 1) <= n:
            search(value, total_factor * (k + 1), i+1)

search(1, 1, 1)
print(min_value)


import math
import functools

@functools.lru_cache(maxsize=None)
def factorial(n):
    return math.factorial(n)

@functools.lru_cache(maxsize=None)
def binomial(k, n):
    return factorial(n) // (factorial(k) * factorial(n - k))

def P(k, n, m):
    return k ** 2 * binomial(k, m) * binomial(n - k, n * m - m)

def solve(n, m):
    return sum(P(k, n, m) for k in range(1, min(n, m) + 1)) / binomial(n, m * n) / n

if __name__ == '__main__':
    n, m = map(int, input().split())

    print(solve(n, m))


# -- code beginning
n, m = map(int, input().split())
print(1-(m*(n-1)**2/((m*n-1)*n)))
# -- code ending


n,m = map(float, raw_input().split())
if n == m == 1:
    print 1
else:
    print 1+(n-1)*(m-1)/(n*m-1))/n


m, n = map(int, input().split())
if m == 1:
    print(1)
else
  print(1/n + (n-1)/n*(m-1)/(n*m-1))


def list_fact(n):
    F=[0]*(n+1)
    F[0]=1
    for i in range(1,n+1):
        F[i]=i*F[i-1]
    return F
S=str(input())
l=list(map(int, S.split(' ')))
n,m=l[0],l[1]
F=list_fact(n*m)
S=0
for k in range(1,min(n,m)+1):
    S+=k*F[m]*F[n]*F[(n-1)*m]*F[(m-1)*n]/(n*F[n*m]*F[k-1]*F[n-k]*F[m-k]*F[n*m-n-m+k])
print(S)


from math import sqrt

class vector:
	def __init__(self, _x = 0, _y = 0):
		self.x = _x
		self.y = _y
	def len(self):
		return sqrt(self.x ** 2 + self.y ** 2)
	def len_sq(self):
		return self.x ** 2 + self.y ** 2
	def __mul__(self, other):
		if (type(self) == type(other)):
			return self.x * other.x + self.y * other.y
		return vector(self.x * other, self.y * other)
	def __mod__(self, other):
		return self.x * other.y - self.y * other.x
	def normed(self):
		length = self.len()
		return vector(self.x / length, self.y / length)
	def normate(self):
		self = self.normed()
	def __str__(self):
		return "(" + str(self.x) + ", " + str(self.y) + ")"
	def __add__(self, other):
		return vector(self.x + other.x, self.y + other.y);
	def __sub__(self, other):
		return vector(self.x - other.x, self.y - other.y);
	def __eq__(self, other):
		return self.x == other.x and self.y == other.y
	def rot(self):
		return vector(self.y, -self.x)

class line:
	def __init__(self, a = 0, b = 0, c = 0):
		self.a = a
		self.b = b
		self.c = c
	def intersect(self, other):
		d = self.a * other.b - self.b * other.a
		dx = self.c * other.b - self.b * other.c
		dy = self.a * other.c - self.c * other.a
		return vector(dx / d, dy / d)
	def fake(self, other):
		d = self.a * other.b - self.b * other.a
		return d
	def __str__(self):
		return str(self.a) + "*x + " + str(self.b) + "*y = " + str(self.c)

def line_pt(A, B):
		d = (A - B).rot()
		return line(d.x, d.y, d * A)

class circle:
	def __init__(self, O = vector(0, 0), r = 0):
		self.O = O
		self.r = r
	def intersect(self, other):
		O1 = self.O
		O2 = other.O
		r1 = self.r
		r2 = other.r
		if (O1 == O2):
			return []
		if ((O1 - O2).len_sq() > r1 ** 2 + r2 ** 2 + 2 * r1 * r2):
			return []
		rad_line = line(2 * (O2.x - O1.x), 2 * (O2.y - O1.y), r1 ** 2 - O1.len_sq() - r2 ** 2 + O2.len_sq())
		central = line_pt(O1, O2)
		M = rad_line.intersect(central)
		# print(M)
		if ((O1 - O2).len_sq() == r1 ** 2 + r2 ** 2 + 2 * r1 * r2):
			return [M]
		d = (O2 - O1).normed().rot()
		if (r1 ** 2 - (O1 - M).len_sq() < 0):
			return []
		d = d * (sqrt(r1 ** 2 - (O1 - M).len_sq()))
		return [M + d, M - d]
	def fake(self, other):
		O1 = self.O
		O2 = other.O
		r1 = self.r
		r2 = other.r
		if (O1 == O2):
			return 1
		if ((O1 - O2).len_sq() > r1 ** 2 + r2 ** 2 + 2 * r1 * r2):
			return 1
		rad_line = line(2 * (O2.x - O1.x), 2 * (O2.y - O1.y), r1 ** 2 - O1.len_sq() - r2 ** 2 + O2.len_sq())
		central = line_pt(O1, O2)
		return rad_line.fake(central)

# a = vector(3, 4)
# b = vector(4, 4)
# print(circle(vector(1, 2), 3).intersect(circle(vector(2, 1), 5)))
n = int(input())
arr = []
m = 1
for i in range(n):
	x, y, r = map(int, input().split())
	arr.append(circle(vector(x, y), r))
for i in range(n):
	for j in range(i + 1, n):
		m *= arr[i].fake(arr[j])
for i in range(n):
	arr[i].O = arr[i].O * m
	arr[i].r = arr[i].r * m
# print(m)
s = set()
V = 0
for i in range(n):
	for j in range(i + 1, n):
		tmp = arr[i].intersect(arr[j])
		for e in tmp:
			s.add((round(e.x, 100), round(e.y, 100)))
V += len(s)
E = 0

par = [i for i in range(n)]

def get_par(v):
	if (par[v] != v):
		par[v] = get_par(par[v])
	return par[v]
def unite(v, u):
	par[get_par(v)] = get_par(u)
for i in range(n):
	s = set()
	for j in range(n):
		tmp = arr[i].intersect(arr[j])
		if (len(tmp)):
			unite(i, j)
		for e in tmp:
			s.add((round(e.x, 100), round(e.y, 100)))
	E += len(s)
# print(V, E)
# print(len({get_par(i) for i in range(n)}))
print(E - V + 1 + len({get_par(i) for i in range(n)}))
			unite(i, j)
		for e in tmp:
			s.add((round(e.x, 100), round(e.y, 100)))
	E += len(s)
# print(V, E)
# print(len({get_par(i) for i in range(n)}))
print(E - V + 1 + len({get_par(i) for i in range(n)}))from math import sqrt

class vector:
	def __init__(self, _x = 0, _y = 0):
		self.x = _x
		self.y = _y
	def len(self):
		return sqrt(self.x ** 2 + self.y ** 2)
	def len_sq(self):
		return self.x ** 2 + self.y ** 2
	def __mul__(self, other):
		if (type(self) == type(other)):
			return self.x * other.x + self.y * other.y
		return vector(self.x * other, self.y * other)
	def __mod__(self, other):
		return self.x * other.y - self.y * other.x
	def normed(self):
		length = self.len()
		return vector(self.x / length, self.y / length)
	def normate(self):
		self = self.normed()
	def __str__(self):
		return "(" + str(self.x) + ", " + str(self.y) + ")"
	def __add__(self, other):
		return vector(self.x + other.x, self.y + other.y);
	def __sub__(self, other):
		return vector(self.x - other.x, self.y - other.y);
	def __eq__(self, other):
		return self.x == other.x and self.y == other.y
	def rot(self):
		return vector(self.y, -self.x)

class line:
	def __init__(self, a = 0, b = 0, c = 0):
		self.a = a
		self.b = b
		self.c = c
	def intersect(self, other):
		d = self.a * other.b - self.b * other.a
		dx = self.c * other.b - self.b * other.c
		dy = self.a * other.c - self.c * other.a
		return vector(dx / d, dy / d)
	def fake(self, other):
		d = self.a * other.b - self.b * other.a
		return d
	def __str__(self):
		return str(self.a) + "*x + " + str(self.b) + "*y = " + str(self.c)

def line_pt(A, B):
		d = (A - B).rot()
		return line(d.x, d.y, d * A)

class circle:
	def __init__(self, O = vector(0, 0), r = 0):
		self.O = O
		self.r = r
	def intersect(self, other):
		O1 = self.O
		O2 = other.O
		r1 = self.r
		r2 = other.r
		if (O1 == O2):
			return []
		if ((O1 - O2).len_sq() > r1 ** 2 + r2 ** 2 + 2 * r1 * r2):
			return []
		rad_line = line(2 * (O2.x - O1.x), 2 * (O2.y - O1.y), r1 ** 2 - O1.len_sq() - r2 ** 2 + O2.len_sq())
		central = line_pt(O1, O2)
		M = rad_line.intersect(central)
		# print(M)
		if ((O1 - O2).len_sq() == r1 ** 2 + r2 ** 2 + 2 * r1 * r2):
			return [M]
		d = (O2 - O1).normed().rot()
		if (r1 ** 2 - (O1 - M).len_sq() < 0):
			return []
		d = d * (sqrt(r1 ** 2 - (O1 - M).len_sq()))
		return [M + d, M - d]
	def fake(self, other):
		O1 = self.O
		O2 = other.O
		r1 = self.r
		r2 = other.r
		if (O1 == O2):
			return 1
		if ((O1 - O2).len_sq() > r1 ** 2 + r2 ** 2 + 2 * r1 * r2):
			return 1
		rad_line = line(2 * (O2.x - O1.x), 2 * (O2.y - O1.y), r1 ** 2 - O1.len_sq() - r2 ** 2 + O2.len_sq())
		central = line_pt(O1, O2)
		return rad_line.fake(central)

# a = vector(3, 4)
# b = vector(4, 4)
# print(circle(vector(1, 2), 3).intersect(circle(vector(2, 1), 5)))
n = int(input())
arr = []
m = 1
for i in range(n):
	x, y, r = map(int, input().split())
	arr.append(circle(vector(x, y), r))
for i in range(n):
	for j in range(i + 1, n):
		m *= arr[i].fake(arr[j])
for i in range(n):
	arr[i].O = arr[i].O * m
	arr[i].r = arr[i].r * m
# print(m)
s = set()
V = 0
for i in range(n):
	for j in range(i + 1, n):
		tmp = arr[i].intersect(arr[j])
		for e in tmp:
			s.add((round(e.x, 100), round(e.y, 100)))
V += len(s)
E = 0

par = [i for i in range(n)]

def get_par(v):
	if (par[v] != v):
		par[v] = get_par(par[v])
	return par[v]
def unite(v, u):
	par[get_par(v)] = get_par(u)
for i in range(n):
	s = set()
	for j in range(n):
		tmp = arr[i].intersect(arr[j])
		if (len(tmp)):
			unite(i, j)
		for e in tmp:
			s.add((round(e.x, 100), round(e.y, 100)))
	E += len(s)
# print(V, E)
# print(len({get_par(i) for i in range(n)}))
print(E - V + 1 + len({get_par(i) for i in range(n)}))


import sys
import math

def dist(a, b):
    return math.sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]))

def samep(a, b):
    EPS = 0.01
    if a - b < -EPS or a - b > EPS:
        return False
    return True

def same(a, b):
    return samep(a[0], b[0]) and samep(a[1], b[1])

def stat(a, tata):
    if tata[a] == a:
        return a
    x = stat(tata[a], tata)
    tata[a] = x
    return x

def unesc(a, b, tata):
    y = stat(b, tata)
    x = stat(a, tata)
    if x != y:
        tata[x] = y
    return

#fin = open('cerc.in', 'r')
#fout = open('cerc.out', 'w')
fin = sys.stdin
fout = sys.stdout
n = int(fin.readline())
a = []
for i in range(0, n):
    a.append(tuple([int(number) for number in fin.readline().split()]))
#find V
pnt = []
pntc = []
for i in range(0, n):
    for j in range(i + 1, n):
        if a[i][0] != a[j][0] or a[i][1] != a[j][1]:
            a0, a1, a2 = a[i]
            b0, b1, b2 = a[j]
            c0 = 2 * (b0 - a0)
            c1 = 2 * (b1 - a1)
            c2 = -a0 * a0 + -a1 * a1 + a2 * a2 + b0 * b0 + b1 * b1 - b2 * b2
            npoints = []
            if c0 == 0:
                y0 = c2 / c1
                x1 = a2 * a2 - (y0 - a1) * (y0 - a1)
                x0 = math.sqrt(x1) + a0
                npoints.append((-x0, y0), (x0, y0))
            else:
                d0 = -c1 / c0
                d1 = c2 / c0
                e0 = (d0 * d0 + 1)
                e1 = 2 * d0 * (d1 - a0) - 2 * a1
                e2 = (d1 - a0) * (d1 - a0) + a1 * a1 - a2 * a2
                dt = e1 * e1 - 4 * e2 * e0
                if dt >= 0:
                    y0 = (-e1 - math.sqrt(dt)) / (2 * e0)
                    y1 = (-e1 + math.sqrt(dt)) / (2 * e0)
                    x0 = d0 * y0 + d1
                    x1 = d0 * y1 + d1
                    npoints.append((x0, y0))
                    npoints.append((x1, y1))
            for np in npoints:
                g = 0
                for poz in range(0, len(pnt)):
                    if same(pnt[poz], np):
                        g = 1
                        pntc[poz].add(i)
                        pntc[poz].add(j)
                        break;
                if g == 0:
                    pnt.append(np)
                    pntc.append(set({i, j}))
pntc = [list(x) for x in pntc]
V = len(pnt)
#find C
tata = list(range(0, n))
C = 1
for p in range(0, V):
    for i in range(0, len(pntc[p])):
        for j in range(i + 1, len(pntc[p])):
            unesc(pntc[p][i], pntc[p][j], tata)
for p in range(0, n):
    if tata[p] == p:
        C += 1
#find E
E = 0
for p in range(0, V):
    for x in pntc[p]:
        E += 1
F = E + C - V
fout.write(repr(F))
if fin != sys.stdin:
    fin.close()
    fout.close()


import sys
import math

def stoc(s):
    return tuple(map(int, s.split()))

def ncut(c0, c1):
    d2 = (c0[0]-c1[0])**2 + (c0[1]-c1[1])**2
    rsum2 = (c0[2]+c1[2])**2
    if rsum2 < d2:
        return 0
    elif rsum2 == d2:
        return 1
    else:
        #d = |r0 - r1| ?
        rdiff2 = (c0[2]-c1[2])**2
        if d2 < rdiff2:
            return 0
        elif d2 == rdiff2:
            return 1
        else:
            return 2

def testcuts(cs):
    N=10**10
    eps=1e-5
    ai = 0
    while ai < N:
        a = 2*math.pi*ai/N+.1
        x = cs[0][0] + cs[0][2]*math.cos(a)
        y = cs[0][1] + cs[0][2]*math.sin(a)
        d1 = abs(((x-cs[1][0])**2 + (y-cs[1][1])**2)**.5 - cs[1][2])
        d2 = abs(((x-cs[2][0])**2 + (y-cs[2][1])**2)**.5 - cs[2][2])
        #print x, y, d1, d2
        if abs(d1) + abs(d2) < eps:
            #print x, y, d1, d2
            return True
        if d1 > (cs[0][2]*1e6/N):
            ai += 1e5
        if d2 > (cs[0][2]*1e6/N):
            ai += 1e5
        ai += 1
    return False

xx = sys.stdin.readlines()
n = int(xx[0])
cs = map(stoc, xx[1:])
#print cs

ncuts = ncut(cs[0],cs[1]) + ncut(cs[1],cs[2]) + ncut(cs[2], cs[0])

#Do all three intersect at the same point?
if ncuts >=3 and testcuts(cs):
    ncuts -= 1

print 2 + ncuts


import itertools

n,l,r,x = map(int,raw_input().split())
a = map(int,raw_input().split())
a.sort()
ans = []
combos = []
for i in xrange(2,n+1):
	temp = itertools.combinations(a,i)
	for j in temp:
		combos.append(j)
count = 0

for i in combos:
	tot = sum(i)
	maxi = max(i)
	mini = min(i)
	if(tot>=l and tot<=r and maxi-mini>=x):
		count+=1
print coun


#include <bits/stdc++.h>
#define endl "\n"
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using ll = long long;
using namespace std;
const int INF = 0x3f3f3f3f;

int n, l, r, x, arr[16], cnt;

void go(int i = 0, int sm = 0, int mx = 0, int mn = 1e9+5) {
	if (i == n) {
		if (sm >= l and sm <= r and mx-mn >= x) {
			cnt++;
		}
		return;
	}
	go(i+1, sm+arr[i], max(mx, arr[i]), min(mn, arr[i]));
	go(i+1, sm, mx, mn);
}

int main() {
	IOS
	cin >> n >> l >> r >> x;
	for (int i = 0; i < n; ++i) {
		cin >> arr[i];
	}
	go();
	cout << cnt << endl;
}


import itertools

n,l,r,x = map(int,input().split())
a = map(int,input().split())
a.sort()
ans = []
combos = []
for i in range(2,n+1):
	temp = itertools.combinations(a,i)
	for j in temp:
		combos.append(j)
count = 0

for i in combos:
	tot = sum(i)
	maxi = max(i)
	mini = min(i)
	if(tot>=l and tot<=r and maxi-mini>=x):
		count+=1
print count


import itertools

n,l,r,x = map(int,raw_input().split())
a = map(int,raw_input().split())
a.sort()
ans = []
combos = []
for i in xrange(2,n+1):
	temp = itertools.combinations(a,i)
	for j in temp:
		combos.append(j)
count = 0

for i in combos:
	tot = sum(i)
	maxi = max(i)
	mini = min(i)
	if(tot>=l and tot<=r and maxi-mini>=x):
		count+=1
print count


N, L, R, X = map(int, raw_input().split())
C = map(int, raw_input().split())
Ans = 0

for Cf in range(1, 1 << N):
	V = [C[i] for i in range(N) if Cf & (1 << i) > 0]
	if max(V) - min(V) >= X and L <= sum(V) and sum(V) <= R:
		Ans += 1

print Ans


a, b, c = raw_input().split(' ')

note = ['C','C#','D','D#','E','F','F#','G','G#','A','B','H']

def diff(str1, str2):
    for i in range[note]:
        if (note[i] == str1):
            x = i
        if (note[i] == str2):
            y = i
        if (x < y):
            return y - x
        else:
            if (y < x):
                return 12 - y + x
    return 0

one = diff(a, b)
two = diff(b, c)
if ((one == 3) | (two == 4)):
    print "minor"
else:
    if ((one == 4) | (two == 3)):
        print "major"
    else:
        print "strange"


#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import sys
import itertools as it
input = sys.stdin
output = sys.stdout

Notes = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'B', 'H']

STRANGE = 0
MAJOR = 1
MINOR = 2
TYPES = ['strange','major','minor']

def distance(n1,n2):
    d = n2 - n1
    if n1<n2:
        return d
    else:
        return 12+d

def classify(trinote):
    X = trinote[0]
    Y = trinote[1]
    Z = trinote[2]
    dXY = distance(X,Y)
    dYZ = distance(Y,Z)
    if dXY == 4 and dYZ == 3:
        return MAJOR
    if dXY == 3 and dYZ == 4:
        return MINOR
    return STRANGE

def solve(accord):
    for trinote in it.permutations(accord):
        at = classify(trinote)
        if at != STRANGE:
            return TYPES[at]
    return TYPES[STRANGE]

#print distance(Notes.index('E'), Notes.index('C'))

Ns = input.readline().split(' ')
assert len(Ns) == 3

accord = [Notes.index(n) for n in Ns]
#print Ns
#print [t for t in enumerate(Notes)]
#print accord

s = solve(accord)
output.write(s)

output.write('\n')


so = ['C', 'C#', 'D', 'D#', 'E', 'F','F#', 'G', 'G#', 'A', 'B', 'H']

def solve(a, b, c):
    a = so.index(a)
    b = so.index(b)
    c = so.index(c)
    li = [a,b,c]
    li.sort()

		r1 = li[1] - li[0]
    r2 = li[2] - li[1]
    r3 = li[0] + len(so) - li[2]

		rval = "strange"
    if r1 == 4 and r2 == 3:
        rval = "major"
    elif r2 == 4 and r3 == 3:
        rval = "major"
    elif r3 == 4 and r1 == 3:
        rval = "major"
    if r1 == 3 and r2 == 4:
        rval = "minor"
    elif r2 == 3 and r3 == 4:
        rval = "minor"
    elif r3 == 3 and r1 == 4:
        rval = "minor"
    return rval

for i in xrange(1):
    a, b, c = raw_input().split()
    r = solve(a, b, c)
    print r


import sys

def main():
    for a in sys.argv:
        print(a)
    cha_count = 0
    seq_start = 0
    for i in range(1, len(dna)):
        if dna[i-1] != dna[i] or i == len(dna) - 1:
            if (i - seq_start)%2 == 0:
                cha_count += 1
                seq_start = i
    print(cha_count)
    return 0
main()


def solve(s):
    n = len(s)
    arr = [val for val in s]
    ans = 0
    count = 1
    # print(arr)
    for i in range(n - 1):
        if arr[i] == arr[i + 1]:
            count += 1
        else:
            if count % 2 == 0:
                ans += 1
            count = 1
    if count %2 == 0:
        ans += 1
    return ans

n = int(input())

for i in range(n):
    s = input()
    ans = solve(s)
    print(ans)


from itertools import groupby
s = raw_input().strip()
cnt = 0
for x,y in groupby(s):
  cnt += (len(list(y)) & 1):
print cnt


a=input()
total=1
ans=0
for i in range(len(a)):
    if i+1<len(a)&&a[i]==a[i+1]:
        total+=1
    else:
        if total%2:
            ans+=1
        total=0
print(ans)


graph = {'A':[['B',2],['D',1]],
		'B':[['A',2],['D',2]],
		'C':[['D',3]],
		'D':[['A',1],['B',2]]}
connect_to = 'C'
incoming_nodes = graph[connect_to]
minimum_weight = [incoming_nodes
print(incoming_nodes)


m100, m10 = input().split(' ')

m100 = int(m100)
m10 = int(m10)

turn_no = 1

while True:
    if turn_no % 2: # Ceil
        if m100 >= 2:
            if m10 >= 2:
                m100 -= 2
                m10 -= 2
            else:
                break
        elif m100 == 1:
            if m10 >= 12:
                m100 -= 1
                m10 -= 12
            else:
                break
        else:
            if m10 >= 22:
                m10 -= 22
            else:
                break
    else: # Hanako
        if m10 >= 22:
            m10 -= 22
        elif m10 >= 12:
            if m100 >= 1:
                m100 -= 1
                m10 -= 12
            else:
                break
        elif m10 >= 2:
            if m100 >= 2:
                m100 -= 2
                m10 -= 2
            else:
                break
        else:
            break

    turn_no += 1

if turn_no % 2:
    print 'Hanako'
else:
    print 'Ciel'


numOfCities, pos = [int(x) for x in input().split()]
criminals = [int(x) for x in input().split()]
CriminalsCought = 0
max_dist = pos-1 if pos > numOfCities//2 else numOfCities-pos
if criminals[pos-1]: CriminalsCought+=1
for i in range(1,max_dist+1):
    if pos-1-i < 0 or pos-1+i > numOfCities-1:
        if pos > numOfCities//2: CriminalsCought+= criminals[pos-1-i]
        else: CriminalsCought+= criminals[pos-1+i]
    else:
        if criminals[pos-1+i] and criminals[pos-1-i]: CriminalsCought +=2
print(CriminalsCought)


import sys

f = open('test.in','r')
#f=sys.stdin
x,y = map(int, f.readline().strip().split())

if x>=2 and y>=24:
    x = x-y/12
    y %= 24

while True:
    if 100*x+10*y>=220 and y>=2:
        #ceil
        if x>=2: x,y=x-2,y-2
        elif x==1: x,y=0,y-12
        else: y-=22
    else:
        print 'Hanako'
        break

    if 100*x+10*y>=220 and y>=2:
        #hanako
        if y>=22: y=y-22
        elif y>=12: x,y=x-1,y-12
        else: x,y=x-2,y-2
    else:
        print 'Ceil'
        break


x,y = map(int, raw_input().split())
r = [(2,2),(1,12),(0,22)]
while True:
    for a in r:
        if x >= a[0] and y >= a[1]:
            x -= a[0]
            y -= a[1]
            break;
        else:
            print "Hanako"
            break
        for a in reversed(r):
            if x >= a[0] and y >= a[1]:
                x -= a[0]
                y -= a[1]
                break
        else:
            print "Ciel"
            break


#!/usr/bin/env python3

import math

#tcs = int(input())
#for tc in range(tcs):
    n,m,k = [int(i) for i in input().split(' ')]

    row = math.ceil(k/(m*2))
    if k%(m*2) is not 0:
        col = math.ceil((k%(m*2))/2)
    else:
        col = m
    lr = 'L' if ((k%(m*2))%2==1) else 'R'

    print(row,col,lr)


<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>73a8b3bc-dbda-4cae-af7b-e5012366e265</ProjectGuid>
    <ProjectHome>.</ProjectHome>
    <StartupFile>santa.py</StartupFile>
    <SearchPath>
    </SearchPath>
    <WorkingDirectory>.</WorkingDirectory>
    <OutputPath>.</OutputPath>
    <Name>santa</Name>
    <RootNamespace>santa</RootNamespace>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugSymbols>true</DebugSymbols>
    <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="santa.py" />
  </ItemGroup>
  <PropertyGroup>
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
    <PtvsTargetsFile>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets</PtvsTargetsFile>
  </PropertyGroup>
  <Import Condition="Exists($(PtvsTargetsFile))" Project="$(PtvsTargetsFile)" />
  <Import Condition="!Exists($(PtvsTargetsFile))" Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
  <!-- Uncomment the CoreCompile target to enable the Build command in
       Visual Studio and specify your pre- and post-build commands in
       the BeforeBuild and AfterBuild targets below. -->
  <!--<Target Name="CoreCompile" />-->
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
</Project>


k = input().split()
n = int(k[0])
m = int(k[1])
k = int(k[2])

if ( k <= n+m-2 ):
    if ( k < n ):
        outn = int((n / (k + 1)) * m)
    else:
        outn = int(m / (k - n + 2))
    if ( k < m):
        outm = int( m / ( k + 1)) * n
    else:
        outm = int( n / ( k - m + 2 )
    print (max( outn, outm))
print -1


def main():
    n, m, k = map(int, raw_input().split())
    if n + m < k + 2:
        print -1
        return
    if n < m:
        n, m = m , n
    result = max((m / 1) * (n / (k + 1)), (n / 1) * (m / (k + 1))

    for x in range(2, min(k + 2, m + 1)):
        a = (n / x)
        b = (m / k - x)
        if a * b > result:
            result = a * b
        elif (n * m) / (x * (k + 2 - x)) < result:
            break
    print result
main()


l = input().split()
n = int(l[0])
m = int(l[1])
k = int(l[2])

if ( k <= n+m-2 ):
    if ( k < n ):
        outn = int((n / (k + 1))) * m
    else:
        outn = int(m / (k - n + 2))
    if ( k < m):
        outm = int( m / ( k + 1)) * n
    else:
        outm = int( n / ( k - m + 2 )
    print ( outn)
else:
    print ( "-1")


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

if k <= n + m - 2:
    x = min(k + 1, n)
    y = k + 2 - x
    a = (n // x) * (m //  y)
    y = min(k + 1, m)
    x = k + 2 - y
    b = (n //  x) * (m / / y)
    print(max(a, b))
else:
    print(-1)


l = input().split()
n = int(l[0])
m = int(l[1])
k = int(l[2])

if ( k <= n+m-2 ):
    if ( k < n ):
        outn = int((n / (k + 1))) * m
    else:
        outn = int(m / (k - n + 2))
    if ( k < m):
        outm = int( m / ( k + 1)) * n
    else:
        outm = int( n / ( k - m + 2 )
    print ( "", max(outn, outm), sep = '')
else:
    print ( "-1")


n,k = map(int,input().split())
if(k==1):
    print("Yes")
elif(k>100 || k>=n):
    print("No")
else:
    for i in range(1,k+1):
        if((n+1)%i != 0):
            print("No")
            return
    print("Yes")


#!/bin/python3
def func(n,k):
	lst = []
	for i in range(1,k+1):
		a = n%i
		if not in lst:
			lst.append(a)
		else:
			return "No"
	return "Yes"

n,k = map(int,input().split())
print(func(n,k))


 n,k=map(int,input().split())
print(['Yes','No'][any((n+1)%i for i in range(2,k+1))])


 k = map(int, input().split())

print(['Yes', 'No'][any((n + 1) % d
                        for d in range(2, k + 1))])


n, k = map(int, raw_input().split())

lista = [0]*100000

flag = True
if k > 1000000: k = 100000
for i in range(1, k+1):
    lista[n%i] += 1
    if lista[n%i] > 1:
         print "No"
        flag = False
        break

if flag: print "Yes"


def count(l,r):
	diff=r-l+1
	ans=[diff/3,diff/3,diff/3]
	if diff%3==0:
		return ans
	if diff%3==1:
		ans[l%3]+=1
		return ans
	else:
		ans[l%3]+=1
		ans[((l%3)+1)%3]+=1
		return ans

mod=1000000007
n,l,r=map(int,raw_input().split())
# n,l,r=1,1,1
x,y,z=count(l,r)
if n==1:
	return x
ans0=[1 for i in range(n+1)]
ans1=[1 for i in range(n+1)]
ans2=[1 for i in range(n+1)]

ans0[0]=1
ans0[1]=x
ans0[2]=(x*x)+(2*y*z)

ans1[0]=1
ans1[1]=y
ans1[2]=(z*z)+(2*x*y)

ans2[0]=1
ans2[1]=z
ans2[2]=(y*y)+(2*x*z)

for i in range(3,n+1):
	ans0[i]=((x*ans0[i-1])%mod+(y*ans2[i-1])%mod+(z*ans1[i-1])%mod)%mod
	ans1[i]=((x*ans1[i-1])%mod+(y*ans0[i-1])%mod+(z*ans2[i-1])%mod)%mod
	ans2[i]=((x*ans2[i-1])%mod+(y*ans1[i-1])%mod+(z*ans0[i-1])%mod)%mod
print ans0[-1]


#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;

ll dp[200005][3];

ll cntMod(ll l, ll r, ll m) {
  ll lb, ub;
  if (l % 3 == m) {
    lb = l;
  } else {
    if (m > l % 3) {
      lb = l + (m - l % 3);
    } else {
      lb = l + (m + 3 - l % 3);
    }
  }
  if (r % 3 == m) {
    ub = r;
  } else {
    if (m < r % 3) {
      ub = r - (r % 3 - m);
    } else {
      ub = r - (r % 3 - m + 3);
    }
  }
  if (lb > ub) {
    return 0;
  } else {
    return (ub - lb) / 3 + 1;
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  ll mod0, mod1, mod2, l, r, lb, ub;
  cin >> n >> l >> r;
  mod0 = cntMod(l, r, 0);
  mod1 = cntMod(l, r, 1);
  mod2 = cntMod(l, r, 2);
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j + )
  }
  return 0;
}


import math

if __name__ == '__main__':
    n, l, r = list(map(int, input().split()))
    mod_counts = [
        math.floor(r/3) - math.ceil(l/3) + 1, math.floor((r-1)/3) - math.ceil((l-1)/3) + 1,
        math.floor((r+1)/3) - math.ceil((l+1)/3) + 1]
    dp = [[None] * 3 for _ in range(n)]
    dp[0] = mod_counts
    for i in range(1, n):
        dp[i][0] = (dp[i-1][0] * mod_counts[0]) + (dp[i-1][1] * mod_counts[2]) + (dp[i-1][2] * mod_counts[1])
        dp[i][1] = (dp[i-1][0] * mod_counts[1]) + (dp[i-1][1] * mod_counts[0]) + (dp[i-1][2] * mod_counts[2])
        dp[i][2] = (dp[i-1][0] * mod_counts[2]) + (dp[i-1][1] * mod_counts[1]) + (dp[i-1][2] * mod_counts[0])
    res = dp[-1][0]
    print(res % (10 ** 9 + 7))


line = raw_input()
previous = ''
res = 0
consecutive = 0
for c in line:
    if consecutive == 5:
        consecutive = 0
        res = res + 1
    if c == previous:
        consecutive = consecutive + 1
    else:
        if consecutive != 0:
            res = res + 1
        consecutive = 1
    prev = c
if consecutive != 0:
    res = res + 1
print res


import fileinput
import sys

def helper(trips, currentCombo, prevChar, string):
    if (len(string) == 0):
        sys.stdout.write("%d" % trips)
        return

    c = string[0];
    if prevChar != ' ': #if this is not the first character in the str
        if (c == prevChar): #same char as prev
            currentCombo += 1
            if ((currentCombo % 5) == 1):
                trips += 1
        else:               #different char from prev
            currentCombo = 1
            trips +=1

    else:               #if this is the first character in the str
        trips = 1
        currentCombo = 1

    return helper(trips, currentCombo, c, string[1:])

for line in fileinput.input():
    inputString = line; #get input
    output = helper(0, 0, ' ', inputString)


s = input()

cur = s[0]
cnt = 1
ans = 0

for i in range(1, len(s):
    x = s[i]
    if(cur != x):
        ans = ans + 1
        cnt = 1
        cur = x
    else:
        if(cnt < 5):
            cnt = cnt + 1
        else:
            ans = ans + 1
            cnt = 1
            cur = x

print (ans)


# -*- mode: python; encoding: utf-8; -*-

#print "------------------------------------"
#text = u"пушкин.рф"
#print text
#puny = encodings.punycode.punycode_encode(text)
#print puny
#print encodings.punycode.punycode_decode(puny, "")

s = "CPCPCPC"#raw_input()
n = len(s)
i = 0
ans = 0
while i < n:
    cnt = 0;
    prev = s[i]
    while i < n and s[i] = prev and cnt < 5:
        i += 1
        j += 1
    ans += 1
print ans


#!/usr/bin/env python
# -*- coding: utf-8 -*-
s = raw_input()
s = list(s)
i = 0
j = 0
total = 0
while i < len(s):
	j = i+1
	count = 1
	while j < len(s):
		if s[j] == s[i]:
			count += 1
		else:
			break
	if count < 5:
		total += 1
	else:
		total += count/5

	i = j

print total


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

n,m,z = map(int ,raw_input().split())
g = gcd(n,m)
l = (n * m) / g
print z / l


n,m,z=map(int,input().split())
k=0
for i in range(n,z+1,n):
	if i%m=0:
		k+=1
print(k)


def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)
n,m,z = map(int,input().split())
if m == 0:
    print(0)
elif (n==m):
    print(z//n)
else:
    print(z//(gcd(n,m))


mport sys

def lcm(x, y):
   if x > y:
       z = x
   else:
       z = y

   while(True):
       if((z % x == 0) and (z % y == 0)):
           lcm = z
           break
       z += 1

   return lcm

for line in sys.stdin:
        n = int(line.split(" ")[0])
        m = int(line.split(" ")[1])
        z = int(line.split(" ")[2])

print int(z/lcm(n,m))


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

def gcd(a,b):
	r = 0
    while b > 0:
        r = a%b
        a = b
        b = r
    return a

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

t=x[2]//lcm(x[0],x[1])
print(t)