'''simple docstring'''






import math

import numpy as np
import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute





def  _SCREAMING_SNAKE_CASE		(      __snake_case							:			Optional[Any] = 3				):



     if isinstance(lowerCamelCase_   ,		lowerCamelCase_				):
          raise TypeError('number of qubits must be a integer.'				)
     if number_of_qubits <= 0:
          raise ValueError('number of qubits must be > 0.'				)
     if math.floor(lowerCamelCase_				) != number_of_qubits:
          raise ValueError('number of qubits must be exact integer.'				)
     if number_of_qubits > 1_0:
          raise ValueError('number of qubits too large to simulate(>10).'				)

     _A    		=  QuantumRegister(lowerCamelCase_   ,		'qr'				)
     _A    		=  ClassicalRegister(lowerCamelCase_   ,		'cr'				)

     _A    		=  QuantumCircuit(lowerCamelCase_   ,		lowerCamelCase_				)

     _A    		=  number_of_qubits

     for i in range(lowerCamelCase_				):
          quantum_circuit.h(number_of_qubits - i - 1				)
          counter -= 1
          for j in range(lowerCamelCase_				):
               quantum_circuit.cp(np.pi / 2 ** (counter - j)   ,		lowerCamelCase_   ,		lowerCamelCase_				)

     for k in range(number_of_qubits // 2				):
          quantum_circuit.swap(lowerCamelCase_   ,		number_of_qubits - k - 1				)

     # measure all the qubits
     quantum_circuit.measure(lowerCamelCase_   ,		lowerCamelCase_				)
     # simulate with 10000 shots
     _A    		=  Aer.get_backend('qasm_simulator'				)
     _A    		=  execute(lowerCamelCase_   ,		lowerCamelCase_   ,		shots=1_0_0_0_0				)

     return job.result().get_counts(lowerCamelCase_				)


if __name__ == "__main__":
   print(
       F'''Total count for quantum fourier transform state is: \
    {quantum_fourier_transform(3)}'''
   )










'''simple docstring'''




def 		__A		(  lowerCamelCase_			,			lowerCamelCase_	):


		"""simple docstring"""



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



def 		__A		(  lowerCamelCase_	):


		"""simple docstring"""



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



def 		__A		(  lowerCamelCase_	):


		"""simple docstring"""



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



def 		__A		(  lowerCamelCase_	):


		"""simple docstring"""



		return catalan_number(lowerCamelCase_	) * factorial(lowerCamelCase_	)


if __name__ == "__main__":
							__UpperCAmelCase            =       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.'''
							)



