#!/usr/bin/python

import sys, string

if len(sys.argv) > 1:
	n = string.atoi(sys.argv[1])
else:
	n = string.atoi(raw_input("Enter n: "))

# Calculate the (n-1)th Catalan number, based on the numbers of ways of
# pairwise parenthesizing a string of n tokens.  See Gardner, _Time
# Travel and Other Mathematical Bewilderments_, p. 256.

# Make a list of the first n letters of the English alphabet.
start = []
for i in range(n):
	start.append(chr(ord("a") + i))

universe = [start]

for counter in range(n-1):
	new_universe = []

	# Pairwise parenthesize everything in the universe
	for sample in universe:
		for i in range(len(sample)-1):
			temp = sample[:]
			temp[i] = "(" + temp[i] + temp[i+1] + ")"
			del(temp[(i+1)])
			new_universe.append(temp)

	# Replace the universe with a list of all possible pairwise
	# parenthesizations of everything in the old universe
	universe = new_universe

# Change a list of lists of strings into a list of strings
universe = map(lambda x: x[0], universe)

# Print out the unique parenthesizations and how many there are
universe.sort()

old = ""
total = 0

for x in universe:
	if x != old:
		print x
		total = total + 1
	old = x

print total
