

"""simple docstring"""




from copy import deepcopy





class  lowerCamelCase    :

			def __init__(       self					:    Optional[Any]     ,					__UpperCAmelCase					:    list[int] | None = None     ,					__UpperCAmelCase					:    int | None = None							) ->     None:

						if arr is None and size is not None:
									SCREAMING_SNAKE_CASE__										=   size
									SCREAMING_SNAKE_CASE__										=   [0] * size
						elif arr is not None:
									self.init(__UpperCAmelCase							)
						else:
									raise ValueError("""Either arr or size must be specified"""							)

			def        SCREAMING_SNAKE_CASE					(       self					:    Dict     ,					__UpperCAmelCase					:    list[int]							) ->     None:
						SCREAMING_SNAKE_CASE__										=   len(__UpperCAmelCase							)
						SCREAMING_SNAKE_CASE__										=   deepcopy(__UpperCAmelCase							)
						for i in range(1     ,					self.size							):
									SCREAMING_SNAKE_CASE__										=   self.next_(__UpperCAmelCase							)
									if j < self.size:
												self.tree[j] += self.tree[i]

			def        SCREAMING_SNAKE_CASE					(       self					:    Optional[Any]							) ->     list[int]:
						SCREAMING_SNAKE_CASE__										=   self.tree[:]
						for i in range(self.size - 1     ,					0     ,					-1							):
									SCREAMING_SNAKE_CASE__										=   self.next_(__UpperCAmelCase							)
									if j < self.size:
												arr[j] -= arr[i]
						return arr

			@staticmethod
			def        SCREAMING_SNAKE_CASE					(       __UpperCAmelCase					:    int							) ->     int:
						return index + (index & (-index))

			@staticmethod
			def        SCREAMING_SNAKE_CASE					(       __UpperCAmelCase					:    int							) ->     int:
						return index - (index & (-index))

			def        SCREAMING_SNAKE_CASE					(       self					:    Tuple     ,					__UpperCAmelCase					:    int     ,					__UpperCAmelCase					:    int							) ->     None:
						if index == 0:
									self.tree[0] += value
									return
						while index < self.size:
									self.tree[index] += value
									SCREAMING_SNAKE_CASE__										=   self.next_(__UpperCAmelCase							)

			def        SCREAMING_SNAKE_CASE					(       self					:    Optional[int]     ,					__UpperCAmelCase					:    int     ,					__UpperCAmelCase					:    int							) ->     None:
						self.add(__UpperCAmelCase     ,					value - self.get(__UpperCAmelCase							)							)

			def        SCREAMING_SNAKE_CASE					(       self					:    Tuple     ,					__UpperCAmelCase					:    int							) ->     int:
						if right == 0:
									return 0
						SCREAMING_SNAKE_CASE__										=   self.tree[0]
						right -= 1  # make right inclusive
						while right > 0:
									result += self.tree[right]
									SCREAMING_SNAKE_CASE__										=   self.prev(__UpperCAmelCase							)
						return result

			def        SCREAMING_SNAKE_CASE					(       self					:    Any     ,					__UpperCAmelCase					:    int     ,					__UpperCAmelCase					:    int							) ->     int:
						return self.prefix(__UpperCAmelCase							) - self.prefix(__UpperCAmelCase							)

			def        SCREAMING_SNAKE_CASE					(       self					:    int     ,					__UpperCAmelCase					:    int							) ->     int:
						return self.query(__UpperCAmelCase     ,					index + 1							)





			def        SCREAMING_SNAKE_CASE					(       self					:    Union[str, Any]     ,					__UpperCAmelCase					:    int							) ->     int:
						value -= self.tree[0]
						if value < 0:
									return -1

						SCREAMING_SNAKE_CASE__										=   1  # Largest power of 2 <= size
						while j * 2 < self.size:
									j *= 2

						SCREAMING_SNAKE_CASE__										=   0

						while j > 0:
									if i + j < self.size and self.tree[i + j] <= value:
												value -= self.tree[i + j]
												i += j
									j //= 2
						return i


if __name__ == "__main__":
						import doctest

						doctest.testmod()





"""simple docstring"""




def 						A							(  snake_case__		,					snake_case__     ):




			'''simple docstring'''


			SCREAMING_SNAKE_CASE__										=   1  # To kept the Calculated Value
			# Since C(n, k) = C(n, n-k)
			if k > (n - k):
						SCREAMING_SNAKE_CASE__										=   n - k
			# Calculate C(n,k)
			for i in range(snake_case__     ):
						result *= n - i
						result //= i + 1
			return result

def 						A							(  snake_case__     ):




			'''simple docstring'''


			return binomial_coefficient(2 * node_count		,					snake_case__     ) // (node_count + 1)

def 						A							(  snake_case__     ):




			'''simple docstring'''


			if n < 0:
						raise ValueError("""factorial() not defined for negative values"""     )
			SCREAMING_SNAKE_CASE__										=   1
			for i in range(1		,					n + 1     ):
						result *= i
			return result

def 						A							(  snake_case__     ):




			'''simple docstring'''


			return catalan_number(snake_case__     ) * factorial(snake_case__     )


if __name__ == "__main__":
						A_				:      Optional[int]           =			int(input("Enter the number of nodes: ").strip() or 0)
						if node_count <= 0:
												raise ValueError("We need some nodes to work with.")
						print(
						    F'Given {node_count} nodes, there are {binary_tree_count(node_count)} '
						    F'binary trees and {catalan_number(node_count)} binary search trees.'
						)


