



'''simple docstring'''

import pytest

from datasets.parallel import ParallelBackendConfig, parallel_backend
from datasets.utils.py_utils import map_nested

from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows






def       __lowercase  (_SCREAMING_SNAKE_CASE      :Tuple       ):  # picklable for multiprocessing
				return i + 1






@require_dill_gt_0_3_2
@require_joblibspark
@require_not_windows
def       __lowercase  ():
				with parallel_backend('''spark'''       ):
								assert ParallelBackendConfig.backend_name == "spark"

				SCREAMING_SNAKE_CASE  :						Any      					= [1, 2, 3]
				with pytest.raises(_SCREAMING_SNAKE_CASE       ):
								with parallel_backend('''unsupported backend'''       ):
												map_nested(_SCREAMING_SNAKE_CASE    ,	_SCREAMING_SNAKE_CASE    ,	num_proc=2       )

				with pytest.raises(_SCREAMING_SNAKE_CASE       ):
								with parallel_backend('''unsupported backend'''       ):
												map_nested(_SCREAMING_SNAKE_CASE    ,	_SCREAMING_SNAKE_CASE    ,	num_proc=-1       )






@require_dill_gt_0_3_2
@require_joblibspark
@require_not_windows
@pytest.mark.parametrize('''num_proc'''    ,	[2, -1]       )
def       __lowercase  (_SCREAMING_SNAKE_CASE      :Union[str, Any]       ):
				SCREAMING_SNAKE_CASE  :						Any      					= [1, 2]
				SCREAMING_SNAKE_CASE  :						Dict      					= {'''a''': 1, '''b''': 2}
				SCREAMING_SNAKE_CASE  :						Union[str, Any]      					= {'''a''': [1, 2], '''b''': [3, 4]}
				SCREAMING_SNAKE_CASE  :						str      					= {'''a''': {'''1''': 1}, '''b''': 2}
				SCREAMING_SNAKE_CASE  :						Tuple      					= {'''a''': 1, '''b''': 2, '''c''': 3, '''d''': 4}
				SCREAMING_SNAKE_CASE  :						Dict      					= [2, 3]
				SCREAMING_SNAKE_CASE  :						Any      					= {'''a''': 2, '''b''': 3}
				SCREAMING_SNAKE_CASE  :						str      					= {'''a''': [2, 3], '''b''': [4, 5]}
				SCREAMING_SNAKE_CASE  :						Optional[Any]      					= {'''a''': {'''1''': 2}, '''b''': 3}
				SCREAMING_SNAKE_CASE  :						int      					= {'''a''': 2, '''b''': 3, '''c''': 4, '''d''': 5}

				with parallel_backend('''spark'''       ):
								assert map_nested(_SCREAMING_SNAKE_CASE    ,	_SCREAMING_SNAKE_CASE    ,	num_proc=_SCREAMING_SNAKE_CASE       ) == expected_map_nested_sa
								assert map_nested(_SCREAMING_SNAKE_CASE    ,	_SCREAMING_SNAKE_CASE    ,	num_proc=_SCREAMING_SNAKE_CASE       ) == expected_map_nested_sa
								assert map_nested(_SCREAMING_SNAKE_CASE    ,	_SCREAMING_SNAKE_CASE    ,	num_proc=_SCREAMING_SNAKE_CASE       ) == expected_map_nested_sa
								assert map_nested(_SCREAMING_SNAKE_CASE    ,	_SCREAMING_SNAKE_CASE    ,	num_proc=_SCREAMING_SNAKE_CASE       ) == expected_map_nested_sa
								assert map_nested(_SCREAMING_SNAKE_CASE    ,	_SCREAMING_SNAKE_CASE    ,	num_proc=_SCREAMING_SNAKE_CASE       ) == expected_map_nested_sa









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




