





from ....configuration_utils import PretrainedConfig
from ....utils import logging


__lowerCamelCase       :     Dict   =     logging.get_logger(__name__)

__lowerCamelCase       :     Optional[int]   =     {
    """CarlCochet/trajectory-transformer-halfcheetah-medium-v2""": (
        """https://huggingface.co/CarlCochet/trajectory-transformer-halfcheetah-medium-v2/resolve/main/config.json"""
    ),
    # See all TrajectoryTransformer models at https://huggingface.co/models?filter=trajectory_transformer
}



class 					A__   (       __snake_case			):
      _UpperCAmelCase	:Tuple						    =   'trajectory_transformer'
      _UpperCAmelCase	:Union[str, Any]						    =   ['past_key_values']
      _UpperCAmelCase	:Optional[Any]						    =   {
          'hidden_size': 'n_embd',
          'num_attention_heads': 'n_head',
          'num_hidden_layers': 'n_layer',
      }





      def __init__( self       ,							A_=100       ,							A_=5       ,							A_=1       ,							A_=1       ,							A_=249       ,							A_=6       ,							A_=17       ,							A_=25       ,							A_=4       ,							A_=4       ,							A_=128       ,							A_=0.1       ,							A_=0.1       ,							A_=0.1       ,							A_=0.00_06       ,							A_=512       ,							A_=0.02       ,							A_=1e-12       ,							A_=1       ,							A_=True       ,							A_=1       ,							A_=5_0256       ,							A_=5_0256       ,							**A_       ,							):
       '''simple docstring'''




       UpperCamelCase	:					Optional[int]       	=   vocab_size
       UpperCamelCase	:					Optional[int]       	=   action_weight
       UpperCamelCase	:					Optional[int]       	=   reward_weight
       UpperCamelCase	:					Union[str, Any]       	=   value_weight
       UpperCamelCase	:					Optional[int]       	=   max_position_embeddings
       UpperCamelCase	:					Union[str, Any]       	=   block_size
       UpperCamelCase	:					Dict       	=   action_dim
       UpperCamelCase	:					List[Any]       	=   observation_dim
       UpperCamelCase	:					str       	=   transition_dim
       UpperCamelCase	:					Optional[Any]       	=   learning_rate
       UpperCamelCase	:					Optional[int]       	=   n_layer
       UpperCamelCase	:					Optional[int]       	=   n_head
       UpperCamelCase	:					Union[str, Any]       	=   n_embd
       UpperCamelCase	:					int       	=   embd_pdrop
       UpperCamelCase	:					List[Any]       	=   attn_pdrop
       UpperCamelCase	:					Union[str, Any]       	=   resid_pdrop
       UpperCamelCase	:					Optional[int]       	=   initializer_range
       UpperCamelCase	:					int       	=   layer_norm_eps
       UpperCamelCase	:					Union[str, Any]       	=   kaiming_initializer_range
       UpperCamelCase	:					List[str]       	=   use_cache
       super().__init__(pad_token_id=A_       ,							bos_token_id=A_       ,							eos_token_id=A_       ,							**A_   )




"""simple docstring"""
from __future__ import annotations






def 		lowercase							(     _snake_case						:      int | str     )     ->bool:
	"""simple docstring"""





	__snake_case	:						List[str]						=				str(_snake_case     )
	return n == n[::-1]






def 		lowercase							(     _snake_case						:      int = 1_000_000     )     ->str:
	"""simple docstring"""





	__snake_case	:						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()))))





