


"""simple docstring"""







def      UpperCAmelCase__ (lowerCAmelCase_     ):




					'''simple docstring'''


					__SCREAMING_SNAKE_CASE		     =       len(lowerCAmelCase_     )
					__SCREAMING_SNAKE_CASE		     =       len(matrix[0]     )
					__SCREAMING_SNAKE_CASE		     =       min(lowerCAmelCase_						,		lowerCAmelCase_     )

					for row in range(lowerCAmelCase_     ):
										# Check if diagonal element is not zero
										if matrix[row][row] != 0:
															# Eliminate all the elements below the diagonal
															for col in range(row + 1						,		lowerCAmelCase_     ):
																				__SCREAMING_SNAKE_CASE		     =       matrix[col][row] / matrix[row][row]
																				for i in range(lowerCAmelCase_						,		lowerCAmelCase_     ):
																									matrix[col][i] -= multiplier * matrix[row][i]
										else:
															# Find a non-zero diagonal element to swap rows
															__SCREAMING_SNAKE_CASE		     =       True
															for i in range(row + 1						,		lowerCAmelCase_     ):
																				if matrix[i][row] != 0:
																									__SCREAMING_SNAKE_CASE     ,						__SCREAMING_SNAKE_CASE		     =       matrix[i], matrix[row]
																									__SCREAMING_SNAKE_CASE		     =       False
																									break
															if reduce:
																				rank -= 1
																				for i in range(lowerCAmelCase_     ):
																									__SCREAMING_SNAKE_CASE		     =       matrix[i][rank]

            # Reduce the row pointer by one to stay on the same row
															row -= 1

					return rank


if __name__ == "__main__":
		import doctest

		doctest.testmod()




"""simple docstring"""







from __future__ import annotations




def      UpperCAmelCase__ (lowerCAmelCase_     ):




					'''simple docstring'''


					__SCREAMING_SNAKE_CASE		     =       str(lowerCAmelCase_     )
					return n == n[::-1]




def      UpperCAmelCase__ (lowerCAmelCase_ = 100_0000     ):




					'''simple docstring'''


					__SCREAMING_SNAKE_CASE		     =       0

					for i in range(1						,		lowerCAmelCase_     ):
										if is_palindrome(lowerCAmelCase_     ) and is_palindrome(bin(lowerCAmelCase_     ).split("b"     )[1]     ):
															total += i
					return total


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