from __future__ import annotations

snake_case      =    []






def        UpperCamelCase_							(			lowerCAmelCase__						,	lowerCAmelCase__						,	lowerCAmelCase__  ):



					"""simple docstring"""

					for i in range(len(UpperCAmelCase_  )  ):
										if board[row][i] == 1:
															return False
					for i in range(len(UpperCAmelCase_  )  ):
										if board[i][column] == 1:
															return False
					for i, j in zip(range(UpperCAmelCase_						,	-1						,	-1  )						,	range(UpperCAmelCase_						,	-1						,	-1  )  ):
										if board[i][j] == 1:
															return False
					for i, j in zip(range(UpperCAmelCase_						,	-1						,	-1  )						,	range(UpperCAmelCase_						,	len(UpperCAmelCase_  )  )  ):
										if board[i][j] == 1:
															return False
					return True






def        UpperCamelCase_							(			lowerCAmelCase__						,	lowerCAmelCase__  ):



					"""simple docstring"""

					if row >= len(UpperCAmelCase_  ):
										solution.append(UpperCAmelCase_  )
										printboard(UpperCAmelCase_  )
										print()
										return True
					for i in range(len(UpperCAmelCase_  )  ):
										if is_safe(UpperCAmelCase_						,	UpperCAmelCase_						,	UpperCAmelCase_  ):
															_lowerCAmelCase			:		Optional[int]          = 1
															solve(UpperCAmelCase_						,	row + 1  )
															_lowerCAmelCase			:		Optional[int]          = 0
					return False






def        UpperCamelCase_							(			lowerCAmelCase__  ):



					"""simple docstring"""

					for i in range(len(UpperCAmelCase_  )  ):
										for j in range(len(UpperCAmelCase_  )  ):
															if board[i][j] == 1:
																				print("Q"						,	end=" "  )
															else:
																				print("."						,	end=" "  )
										print()


# n=int(input("The no. of queens"))
snake_case      =    8
snake_case      =    [[0 for i in range(n)] for j in range(n)]
solve(board, 0)

print("The total no. of solutions are :", len(solution))








def 							SCREAMING_SNAKE_CASE_	(					UpperCAmelCase_	:     int = 1_0_0_0				)			->						int:
       SCREAMING_SNAKE_CASE_							:				int		=2**power
       SCREAMING_SNAKE_CASE_							:				Tuple		=0
       while n:
              SCREAMING_SNAKE_CASE_	,     SCREAMING_SNAKE_CASE_							:				Union[str, Any]		=r + n % 1_0, n // 1_0
       return r


if __name__ == "__main__":
 print(solution(int(str(input()).strip())))
