



'''simple docstring'''

import copy
import os
from typing import Union

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


UpperCAmelCase     		=   logging.get_logger(__name__)

UpperCAmelCase     		=   {
    'microsoft/git-base': 'https://huggingface.co/microsoft/git-base/resolve/main/config.json',
}

class __snake_case(				_lowerCAmelCase ):


						'''simple docstring'''



						UpperCAmelCase							:   List[Any]									=		"git_vision_model"


						def __init__( self     ,	A_=768     ,	A_=3072     ,	A_=12     ,	A_=12     ,	A_=3     ,	A_=224     ,	A_=16     ,	A_="quick_gelu"     ,	A_=1e-5     ,	A_=0.0     ,	A_=0.0_2     ,	**A_     ,	)     ->     List[str]:
							super().__init__(**A_				)

							lowerCAmelCase   =     hidden_size
							lowerCAmelCase   =     intermediate_size
							lowerCAmelCase   =     num_hidden_layers
							lowerCAmelCase   =     num_attention_heads
							lowerCAmelCase   =     num_channels
							lowerCAmelCase   =     patch_size
							lowerCAmelCase   =     image_size
							lowerCAmelCase   =     initializer_range
							lowerCAmelCase   =     attention_dropout
							lowerCAmelCase   =     layer_norm_eps
							lowerCAmelCase   =     hidden_act




						@classmethod
						def     __snake_case   ( cls     ,	A_     ,	**A_				)     ->     "PretrainedConfig":
							cls._set_token_in_kwargs(A_				)

							lowerCAmelCase,       lowerCAmelCase   =     cls.get_config_dict(A_     ,	**A_				)

							# get the vision config dict if we are loading from GITConfig
							if config_dict.get("""model_type"""				) == "git":
								lowerCAmelCase   =     config_dict["""vision_config"""]

							if "model_type" in config_dict and hasattr(cls     ,	"""model_type"""				) and config_dict["model_type"] != cls.model_type:
								logger.warning(
								    f'You are using a model of type {config_dict["model_type"]} to instantiate a model of type '
								    f'{cls.model_type}. This is not supported for all configurations of models and can yield errors.'				)

							return cls.from_dict(A_     ,	**A_				)







class __snake_case(				_lowerCAmelCase ):


						'''simple docstring'''



						UpperCAmelCase							:   Optional[int]									=		"git"


						def __init__( self     ,	A_=None     ,	A_=3_0522     ,	A_=768     ,	A_=6     ,	A_=12     ,	A_=3072     ,	A_="gelu"     ,	A_=0.1     ,	A_=0.1     ,	A_=1024     ,	A_=0.0_2     ,	A_=1e-12     ,	A_=0     ,	A_="absolute"     ,	A_=True     ,	A_=False     ,	A_=101     ,	A_=102     ,	A_=None     ,	**A_     ,	)     ->     List[str]:
							super().__init__(bos_token_id=A_     ,	eos_token_id=A_     ,	pad_token_id=A_     ,	**A_				)

							if vision_config is None:
								lowerCAmelCase   =     {}
								logger.info("""vision_config is None. initializing the GitVisionConfig with default values."""				)

							lowerCAmelCase   =     GitVisionConfig(**A_				)
							lowerCAmelCase   =     vocab_size
							lowerCAmelCase   =     hidden_size
							lowerCAmelCase   =     num_hidden_layers
							lowerCAmelCase   =     num_attention_heads
							lowerCAmelCase   =     hidden_act
							lowerCAmelCase   =     intermediate_size
							lowerCAmelCase   =     hidden_dropout_prob
							lowerCAmelCase   =     attention_probs_dropout_prob
							lowerCAmelCase   =     max_position_embeddings
							lowerCAmelCase   =     initializer_range
							lowerCAmelCase   =     layer_norm_eps
							lowerCAmelCase   =     position_embedding_type
							lowerCAmelCase   =     use_cache
							lowerCAmelCase   =     tie_word_embeddings
							lowerCAmelCase   =     num_image_with_embedding

							lowerCAmelCase   =     bos_token_id
							lowerCAmelCase   =     eos_token_id




						def     __snake_case   ( self				)     ->     List[Any]:
							lowerCAmelCase   =     copy.deepcopy(self.__dict__				)
							lowerCAmelCase   =     self.vision_config.to_dict()
							lowerCAmelCase   =     self.__class__.model_type
							return output




'''simple docstring'''

from __future__ import annotations






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						int | str							)      ->						bool:







	"""simple docstring"""
	lowerCAmelCase   =     str(_SCREAMING_SNAKE_CASE							)
	return n == n[::-1]






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						int = 1_000_000							)      ->						Dict:







	"""simple docstring"""
	lowerCAmelCase   =     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()))))