
from __future__ import annotations






def 				_lowercase				(	UpperCamelCase_						)						->						int:
					'''simple docstring'''


					SCREAMING_SNAKE_CASE__						=					str(a__						)
					return n == n[::-1]






def 				_lowercase				(	UpperCamelCase_ = 1000000						)						->						List[Any]:
					'''simple docstring'''


					SCREAMING_SNAKE_CASE__						=					0

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


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













"""simple docstring"""


from math import loga


def        UpperCAmelCase      (					a__ ):





						'''simple docstring'''






						if a < 0:
												raise ValueError('Input value must be a positive integer' )
						elif isinstance(a__     ,      a__ ):
												raise TypeError('Input value must be a \'int\' type' )
						return 0 if (a == 0) else int(loga(a & -a ) )


if __name__ == "__main__":
		import doctest

		doctest.testmod()