



'''simple docstring'''

import os
import time

import pytest

from datasets.utils.filelock import FileLock, Timeout






def       __lowercase  (_SCREAMING_SNAKE_CASE      :Union[str, Any]       ):
				SCREAMING_SNAKE_CASE  :						Optional[Any]      					= FileLock(str(tmpdir / '''foo.lock'''       )       )
				SCREAMING_SNAKE_CASE  :						List[str]      					= FileLock(str(tmpdir / '''foo.lock'''       )       )
				SCREAMING_SNAKE_CASE  :						List[str]      					= 0.01
				with locka.acquire():
								with pytest.raises(_SCREAMING_SNAKE_CASE       ):
												SCREAMING_SNAKE_CASE  :						Optional[int]      					= time.time()
												locka.acquire(_SCREAMING_SNAKE_CASE       )
												assert time.time() - _start > timeout






def       __lowercase  (_SCREAMING_SNAKE_CASE      :Tuple       ):
				SCREAMING_SNAKE_CASE  :						int      					= '''a''' * 10_00 + '''.lock'''
				SCREAMING_SNAKE_CASE  :						Tuple      					= FileLock(str(tmpdir / filename       )       )
				assert locka._lock_file.endswith('''.lock'''       )
				assert not locka._lock_file.endswith(_SCREAMING_SNAKE_CASE       )
				assert len(os.path.basename(locka._lock_file       )       ) <= 2_55
				SCREAMING_SNAKE_CASE  :						Union[str, Any]      					= FileLock(tmpdir / filename       )
				with locka.acquire():
								with pytest.raises(_SCREAMING_SNAKE_CASE       ):
												locka.acquire(0       )






'''simple docstring'''

from __future__ import annotations






def       __lowercase  (_SCREAMING_SNAKE_CASE      :int | str       ):
				SCREAMING_SNAKE_CASE  :						int      					= str(_SCREAMING_SNAKE_CASE       )
				return n == n[::-1]






def       __lowercase  (_SCREAMING_SNAKE_CASE      :int = 1_00_00_00       ):
				SCREAMING_SNAKE_CASE  :						int      					= 0

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


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




