


"""simple docstring"""







from math import sqrt




def      UpperCAmelCase__ (lowerCAmelCase_ = 100_0000     ):




					'''simple docstring'''


					__SCREAMING_SNAKE_CASE		     =       0
					__SCREAMING_SNAKE_CASE		     =       0
					__SCREAMING_SNAKE_CASE		     =       42

					while num_cuboids <= limit:
										max_cuboid_size += 1
										for sum_shortest_sides in range(2						,		2 * max_cuboid_size + 1     ):
															if sqrt(sum_shortest_sides**2 + max_cuboid_size**2     ).is_integer():
																				num_cuboids += (
																				    min(lowerCAmelCase_						,		sum_shortest_sides // 2     )
																				    - max(1						,		sum_shortest_sides - max_cuboid_size     )
																				    + 1
																				)

					return max_cuboid_size


if __name__ == "__main__":
		print(F"{solution() = }")




"""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()))))
