


'''simple docstring'''







def       lowercase					(_A ,    _A       ):







       """simple docstring"""







       _lowerCAmelCase     :				Optional[int]       =							1  # To kept the Calculated Value
       # Since C(n, k) = C(n, n-k)
       if k > (n - k):
              _lowerCAmelCase     :				Any       =							n - k
       # Calculate C(n,k)
       for i in range(_A       ):
              result *= n - i
              result //= i + 1
       return result






def       lowercase					(_A       ):







       """simple docstring"""







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






def       lowercase					(_A       ):







       """simple docstring"""







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






def       lowercase					(_A       ):







       """simple docstring"""







       return catalan_number(_A       ) * factorial(_A       )


if __name__ == "__main__":
       lowerCAmelCase     :  List[Any]											=    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.'''
       )





'''simple docstring'''







def       lowercase					(_A       ):







       """simple docstring"""







       if len(_A       ) <= 1:
              return [tuple(_A       )]

       _lowerCAmelCase     :				List[str]       =							[]

       def generate(_A ,    _A       ):
              _lowerCAmelCase     :				Any       =							[0] * n
              res.append(tuple(_A       )       )

              _lowerCAmelCase     :				Any       =							0
              while i < n:
                     if c[i] < i:
                            if i % 2 == 0:
                                   _lowerCAmelCase      ,  _lowerCAmelCase     :				Tuple       =							arr[i], arr[0]
                            else:
                                   _lowerCAmelCase      ,  _lowerCAmelCase     :				List[str]       =							arr[i], arr[c[i]]
                            res.append(tuple(_A       )       )
                            c[i] += 1
                            _lowerCAmelCase     :				Optional[int]       =							0
                     else:
                            _lowerCAmelCase     :				Any       =							0
                            i += 1

       generate(len(_A       ) ,    _A       )
       return res


if __name__ == "__main__":
       lowerCAmelCase     :  int											=    input("""Enter numbers separated by a comma:\n""").strip()
       lowerCAmelCase     :  Optional[int]											=    [int(item) for item in user_input.split(""",""")]
       print(heaps(arr))

