






'''simple docstring'''







from __future__ import annotations





def 		_UpperCAmelCase   (							__A							:   Dict      ):
				a_		:  int											=      str(__snake_case      )
				return n == n[::-1]





def 		_UpperCAmelCase   (							__A							:   Tuple = 1_00_00_00      ):
				a_		:  Union[str, Any]											=      0

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


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












'''simple docstring'''







import warnings


warnings.warn(
    'memory_utils has been reorganized to utils.memory. Import `find_executable_batchsize` from the main `__init__`: '
    '`from accelerate import find_executable_batch_size` to avoid this warning.',
    FutureWarning,
)




