


from __future__ import annotations






def 							__lowercase       (			__lowerCAmelCase							:    Optional[Any]       ):
							a__					=					str(__lowerCAmelCase       )
							return n == n[::-1]






def 							__lowercase       (			__lowerCAmelCase							:    Optional[int] = 1_0_0_0_0_0_0       ):
							a__					=					0

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


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








from typing import Dict, List, Optional, Union

import numpy as np

from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import rescale, resize, to_channel_dimension_format
from ...image_utils import (
    ChannelDimension,
    ImageInput,
    PILImageResampling,
    make_list_of_images,
    to_numpy_array,
    valid_images,
)
from ...utils import TensorType, is_vision_available, logging


if is_vision_available():
						import PIL


snake_case							:	str					      =				logging.get_logger(__name__)






def 							__lowercase       (			__lowerCAmelCase							:    Union[str, Any] ,   __lowerCAmelCase							:    Optional[Any]       ):
							a__					=					b.T
							a__					=					np.sum(np.square(__lowerCAmelCase       ) ,   axis=1       )
							a__					=					np.sum(np.square(__lowerCAmelCase       ) ,   axis=0       )
							a__					=					np.matmul(__lowerCAmelCase ,   __lowerCAmelCase       )
							a__					=					aa[:, None] - 2 * ab + ba[None, :]
							return d






def 							__lowercase       (			__lowerCAmelCase							:    List[Any] ,   __lowerCAmelCase							:    str       ):
							a__					=					x.reshape(-1 ,   3       )
							a__					=					squared_euclidean_distance(__lowerCAmelCase ,   __lowerCAmelCase       )
							return np.argmin(__lowerCAmelCase ,   axis=1       )







class 	snake_case_       (lowerCamelCase_				):
					UpperCAmelCase__ :   Optional[Any]   				=      ['''pixel_values''']
					def __init__(				self       :Dict      ,__snake_case       :Optional[Union[List[List[int]], np.ndarray]] = None      ,__snake_case       :bool = True      ,__snake_case       :Dict[str, int] = None      ,__snake_case       :PILImageResampling = PILImageResampling.BILINEAR      ,__snake_case       :bool = True      ,__snake_case       :bool = True      ,**__snake_case       :Optional[int]      ,) ->   None:
												super().__init__(**__snake_case				)
												a__					=					size if size is not None else {'height': 2_56, 'width': 2_56}
												a__					=					get_size_dict(__snake_case				)
												a__					=					np.array(__snake_case				) if clusters is not None else None
												a__					=					do_resize
												a__					=					size
												a__					=					resample
												a__					=					do_normalize
												a__					=					do_color_quantize
					def 			lowerCamelCase__(				self       :Union[str, Any]      ,__snake_case       :np.ndarray      ,__snake_case       :Dict[str, int]      ,__snake_case       :PILImageResampling = PILImageResampling.BILINEAR      ,__snake_case       :Optional[Union[str, ChannelDimension]] = None      ,**__snake_case       :Any      ,) ->   np.ndarray:
												a__					=					get_size_dict(__snake_case				)
												if "height" not in size or "width" not in size:
																			raise ValueError(F'Size dictionary must contain both height and width keys. Got {size.keys()}'				)
												return resize(
												    __snake_case      ,size=(size['height'], size['width'])      ,resample=__snake_case      ,data_format=__snake_case      ,**__snake_case				)
					def 			lowerCamelCase__(				self       :List[Any]      ,__snake_case       :np.ndarray      ,__snake_case       :Optional[Union[str, ChannelDimension]] = None      ,) ->   np.ndarray:
												a__					=					rescale(image=__snake_case      ,scale=1 / 1_27.5      ,data_format=__snake_case				)
												a__					=					image - 1
												return image



					def 			lowerCamelCase__(				self       :Optional[Any]      ,__snake_case       :ImageInput      ,__snake_case       :bool = None      ,__snake_case       :Dict[str, int] = None      ,__snake_case       :PILImageResampling = None      ,__snake_case       :bool = None      ,__snake_case       :Optional[bool] = None      ,__snake_case       :Optional[Union[List[List[int]], np.ndarray]] = None      ,__snake_case       :Optional[Union[str, TensorType]] = None      ,__snake_case       :Optional[Union[str, ChannelDimension]] = ChannelDimension.FIRST      ,**__snake_case       :List[str]      ,) ->   PIL.Image.Image:
												a__					=					do_resize if do_resize is not None else self.do_resize
												a__					=					size if size is not None else self.size
												a__					=					get_size_dict(__snake_case				)
												a__					=					resample if resample is not None else self.resample
												a__					=					do_normalize if do_normalize is not None else self.do_normalize
												a__					=					do_color_quantize if do_color_quantize is not None else self.do_color_quantize
												a__					=					clusters if clusters is not None else self.clusters
												a__					=					np.array(__snake_case				)

												a__					=					make_list_of_images(__snake_case				)

												if not valid_images(__snake_case				):
																			raise ValueError(
																			    'Invalid image type. Must be of type PIL.Image.Image, numpy.ndarray, '
																			    'torch.Tensor, tf.Tensor or jax.ndarray.'				)

												if do_resize and size is None or resample is None:
																			raise ValueError('Size and resample must be specified if do_resize is True.'				)

												if do_color_quantize and clusters is None:
																			raise ValueError('Clusters must be specified if do_color_quantize is True.'				)

												# All transformations expect numpy arrays.
												a__					=					[to_numpy_array(__snake_case				) for image in images]

												if do_resize:
																			a__					=					[self.resize(image=__snake_case      ,size=__snake_case      ,resample=__snake_case				) for image in images]

												if do_normalize:
																			a__					=					[self.normalize(image=__snake_case				) for image in images]

												if do_color_quantize:
																			a__					=					[to_channel_dimension_format(__snake_case      ,ChannelDimension.LAST				) for image in images]
																			# color quantize from (batch_size, height, width, 3) to (batch_size, height, width)
																			a__					=					np.array(__snake_case				)
																			a__					=					color_quantize(__snake_case      ,__snake_case				).reshape(images.shape[:-1]				)

																			# flatten to (batch_size, height*width)
																			a__					=					images.shape[0]
																			a__					=					images.reshape(__snake_case      ,-1				)

																			# We need to convert back to a list of images to keep consistent behaviour across processors.
																			a__					=					list(__snake_case				)
												else:
																			a__					=					[to_channel_dimension_format(__snake_case      ,__snake_case				) for image in images]

												a__					=					{'input_ids': images}
												return BatchFeature(data=__snake_case      ,tensor_type=__snake_case				)




