eolymp
bolt
Try our new interface for solving problems
Problems

Rhyme scheme

Rhyme scheme

Consider a stanza of poetry consisting of n lines. It all lines are divided into several classes within each of which lines rhyme with each other. In this problem we shall consider only those verses in which every line rhymes with at least one other. For example, for the quatrains, there are four possible rhyming schemes that satisfy the preceding paragraph. This scheme \textbf{AABB}, \textbf{ABAB}, \textbf{ABBA} and \textbf{AAAA}. For a given size stanza count the number of different rhyming schemes. \InputFile In the input file contains a positive integer \textbf{n}, not exceeding \textbf{26}. \OutputFile The output file output the number of rhyme schemes applicable to the \textbf{n}-poetry.
Time limit 0.5 seconds
Memory limit 256 MiB
Input example #1
4
Output example #1
4
Author Michael Dworkin
Source Winter School, Kharkov, 2011, Day 3