



"""simple docstring"""







from __future__ import annotations

import random
from collections.abc import Iterable





class   UpperCamelCase	:




	"""simple docstring"""






	def __init__(     self				,UpperCAmelCase_   ):
			_lowercase				: dict[str, bool | None]     =   {literal: None for literal in literals}






	def __str__(     self   ):
			return "{" + " , ".join(self.literals   ) + "}"






	def __len__(     self   ):
			return len(self.literals   )






	def    lowerCamelCase__					(     self				,UpperCAmelCase_   ):
			for literal in self.literals:
					_lowercase				: int     =   literal[:2]
					if symbol in model:
							_lowercase				: List[Any]     =   model[symbol]
					else:
							continue
					if value is not None:
							# Complement assignment if literal is in complemented form
							if literal.endswith("""'"""   ):
									_lowercase				: int     =   not value
					_lowercase				: Any     =   value






	def    lowerCamelCase__					(     self				,UpperCAmelCase_   ):
			for literal in self.literals:
					_lowercase				: int     =   literal.rstrip("""'"""   ) if literal.endswith("""'"""   ) else literal + """'"""
					if symbol in self.literals:
							return True

			self.assign(UpperCAmelCase_   )
			for value in self.literals.values():
					if value in (True, None):
							return value
			return any(self.literals.values()   )







class   UpperCamelCase	:




	"""simple docstring"""






	def __init__(     self				,UpperCAmelCase_   ):
			_lowercase				: Optional[int]     =   list(UpperCAmelCase_   )






	def __str__(     self   ):
			return "{" + " , ".join(str(UpperCAmelCase_   ) for clause in self.clauses   ) + "}"







def  __SCREAMING_SNAKE_CASE (  ):
		_lowercase				: Optional[Any]     =   []
		_lowercase				: Optional[Any]     =   random.randint(1   ,				5      )
		_lowercase				: str     =   """A"""
		_lowercase				: Optional[int]     =   0
		while i < no_of_literals:
				_lowercase				: Any     =   random.randint(1   ,				5      )
				_lowercase				: List[str]     =   base_var + str(__UpperCAmelCase      )
				_lowercase				: Optional[Any]     =   random.randint(0   ,				1      )
				if var_complement == 1:
						var_name += "'"
				if var_name in literals:
						i -= 1
				else:
						literals.append(__UpperCAmelCase      )
				i += 1
		return Clause(__UpperCAmelCase      )


def  __SCREAMING_SNAKE_CASE (  ):
		_lowercase				: set[Clause]     =   set()
		_lowercase				: str     =   random.randint(1   ,				10      )
		while len(__UpperCAmelCase      ) < no_of_clauses:
				clauses.add(generate_clause()      )
		return Formula(__UpperCAmelCase      )


def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase      ):
		_lowercase				: Any     =   formula.clauses
		_lowercase				: List[str]     =   []
		for clause in formula.clauses:
				for literal in clause.literals:
						_lowercase				: Tuple     =   literal[:2]
						if symbol not in symbols_set:
								symbols_set.append(__UpperCAmelCase      )
		return clauses, symbols_set


def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase   ,				__UpperCAmelCase   ,				__UpperCAmelCase      ):
		_lowercase				: Optional[Any]     =   []
		_lowercase				: dict[str, bool | None]     =   {}
		_lowercase				: Optional[Any]     =   []

		for clause in clauses:
				if clause.evaluate(__UpperCAmelCase      ):
						continue
				for literal in clause.literals:
						literals.append(__UpperCAmelCase      )

		for s in symbols:
				_lowercase				: Any     =   s + """'"""
				if (s in literals and sym not in literals) or (
				    s not in literals and sym in literals
				):
						pure_symbols.append(__UpperCAmelCase      )
		for p in pure_symbols:
				_lowercase				: List[str]     =   None
		for s in pure_symbols:
				_lowercase				: str     =   s + """'"""
				if s in literals:
						_lowercase				: int     =   True
				elif sym in literals:
						_lowercase				: Dict     =   False
		return pure_symbols, assignment


def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase   ,				__UpperCAmelCase      ):
		_lowercase				: Optional[Any]     =   []
		for clause in clauses:
				if len(__UpperCAmelCase      ) == 1:
						unit_symbols.append(list(clause.literals.keys()      )[0]      )
				else:
						_lowercase     ,  _lowercase				: Optional[Any]     =   0, 0
						for literal, value in clause.literals.items():
								if value is False:
										f_count += 1
								elif value is None:
										_lowercase				: List[Any]     =   literal
										n_count += 1
						if f_count == len(__UpperCAmelCase      ) - 1 and n_count == 1:
								unit_symbols.append(__UpperCAmelCase      )
		_lowercase				: dict[str, bool | None]     =   {}
		for i in unit_symbols:
				_lowercase				: Optional[Any]     =   i[:2]
				_lowercase				: Tuple     =   len(__UpperCAmelCase      ) == 2
		_lowercase				: Optional[Any]     =   [i[:2] for i in unit_symbols]

		return unit_symbols, assignment


def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase   ,				__UpperCAmelCase   ,				__UpperCAmelCase      ):
		_lowercase				: Dict     =   True
		for clause in clauses:
				_lowercase				: List[Any]     =   clause.evaluate(__UpperCAmelCase      )
				if clause_check is False:
						return False, None
				elif clause_check is None:
						_lowercase				: List[Any]     =   False
						continue

		if check_clause_all_true:
				return True, model

		try:
				_lowercase     ,  _lowercase				: Optional[int]     =   find_pure_symbols(__UpperCAmelCase   ,				__UpperCAmelCase   ,				__UpperCAmelCase      )
		except RecursionError:
				print("""raises a RecursionError and is"""      )
				return None, {}
		_lowercase				: str     =   None
		if len(__UpperCAmelCase      ) > 0:
				_lowercase     ,  _lowercase				: Optional[int]     =   pure_symbols[0], assignment[pure_symbols[0]]

		if p:
				_lowercase				: str     =   model
				_lowercase				: Union[str, Any]     =   value
				_lowercase				: List[str]     =   list(__UpperCAmelCase      )
				if p in tmp_symbols:
						tmp_symbols.remove(__UpperCAmelCase      )
				return dpll_algorithm(__UpperCAmelCase   ,				__UpperCAmelCase   ,				__UpperCAmelCase      )

		_lowercase     ,  _lowercase				: int     =   find_unit_clauses(__UpperCAmelCase   ,				__UpperCAmelCase      )
		_lowercase				: Dict     =   None
		if len(__UpperCAmelCase      ) > 0:
				_lowercase     ,  _lowercase				: Any     =   unit_symbols[0], assignment[unit_symbols[0]]
		if p:
				_lowercase				: List[Any]     =   model
				_lowercase				: Dict     =   value
				_lowercase				: str     =   list(__UpperCAmelCase      )
				if p in tmp_symbols:
						tmp_symbols.remove(__UpperCAmelCase      )
				return dpll_algorithm(__UpperCAmelCase   ,				__UpperCAmelCase   ,				__UpperCAmelCase      )
		_lowercase				: int     =   symbols[0]
		_lowercase				: List[Any]     =   symbols[1:]
		_lowercase     ,  _lowercase				: Optional[Any]     =   model, model
		_lowercase     ,  _lowercase				: int     =   True, False

		return dpll_algorithm(__UpperCAmelCase   ,				__UpperCAmelCase   ,				__UpperCAmelCase      ) or dpll_algorithm(__UpperCAmelCase   ,				__UpperCAmelCase   ,				__UpperCAmelCase      )


if __name__ == "__main__":
		import doctest

		doctest.testmod()

		UpperCAmelCase:  Union[str, Any]			     =				generate_formula()
		print(F'The formula {formula} is', end=""" """)

		UpperCAmelCase     , UpperCAmelCase:  Optional[Any]			     =				generate_parameters(formula)
		UpperCAmelCase     , UpperCAmelCase:  Union[str, Any]			     =				dpll_algorithm(clauses, symbols, {})

		if solution:
				print(F'satisfiable with the assignment {model}.')
		else:
				print("""not satisfiable.""")








"""simple docstring"""







from math import floor, sqrt


def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase      ):
		_lowercase				: Optional[int]     =   0.0
		_lowercase				: Dict     =   1.0
		_lowercase				: Optional[int]     =   int(sqrt(__UpperCAmelCase      )      )
		_lowercase				: Optional[Any]     =   root
		_lowercase				: Dict     =   0
		while integer_part != 2 * root:
				_lowercase				: str     =   denominator * integer_part - numerator
				_lowercase				: Optional[int]     =   (n - numerator**2) / denominator
				_lowercase				: List[str]     =   int((root + numerator) / denominator      )
				period += 1
		return period


def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase = 10000      ):
		_lowercase				: List[str]     =   0
		for i in range(2   ,				n + 1      ):
				_lowercase				: Dict     =   sqrt(__UpperCAmelCase      )
				if sr - floor(__UpperCAmelCase      ) != 0 and continuous_fraction_period(__UpperCAmelCase      ) % 2 == 1:
						count_odd_periods += 1
		return count_odd_periods


if __name__ == "__main__":
		print(F'{solution(int(input().strip()))}')



