


"""simple docstring"""







import unittest

import numpy as np

from transformers import AlbertConfig, is_flax_available
from transformers.testing_utils import require_flax, slow

from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask


if is_flax_available():
		import jax.numpy as jnp

		from transformers.models.albert.modeling_flax_albert import (
		    FlaxAlbertForMaskedLM,
		    FlaxAlbertForMultipleChoice,
		    FlaxAlbertForPreTraining,
		    FlaxAlbertForQuestionAnswering,
		    FlaxAlbertForSequenceClassification,
		    FlaxAlbertForTokenClassification,
		    FlaxAlbertModel,
		)




class 				UpperCamelCase_			(				unittest.TestCase):

	"""simple docstring"""





	def __init__(				self    :       Optional[int]    ,    UpperCAmelCase__    :       Tuple    ,    UpperCAmelCase__    :       Dict=1_3    ,    UpperCAmelCase__    :       str=7    ,    UpperCAmelCase__    :       Optional[int]=True    ,    UpperCAmelCase__    :       Any=True    ,    UpperCAmelCase__    :       str=True    ,    UpperCAmelCase__    :       List[Any]=True    ,    UpperCAmelCase__    :       Optional[int]=9_9    ,    UpperCAmelCase__    :       List[str]=3_2    ,    UpperCAmelCase__    :       int=5    ,    UpperCAmelCase__    :       Optional[Any]=4    ,    UpperCAmelCase__    :       Any=3_7    ,    UpperCAmelCase__    :       int="gelu"    ,    UpperCAmelCase__    :       Optional[Any]=0.1    ,    UpperCAmelCase__    :       Optional[Any]=0.1    ,    UpperCAmelCase__    :       str=5_1_2    ,    UpperCAmelCase__    :       Dict=1_6    ,    UpperCAmelCase__    :       List[Any]=2    ,    UpperCAmelCase__    :       Dict=0.02    ,    UpperCAmelCase__    :       Dict=4    ,    ) ->			Optional[int]:
						__SCREAMING_SNAKE_CASE		     =       parent
						__SCREAMING_SNAKE_CASE		     =       batch_size
						__SCREAMING_SNAKE_CASE		     =       seq_length
						__SCREAMING_SNAKE_CASE		     =       is_training
						__SCREAMING_SNAKE_CASE		     =       use_attention_mask
						__SCREAMING_SNAKE_CASE		     =       use_token_type_ids
						__SCREAMING_SNAKE_CASE		     =       use_labels
						__SCREAMING_SNAKE_CASE		     =       vocab_size
						__SCREAMING_SNAKE_CASE		     =       hidden_size
						__SCREAMING_SNAKE_CASE		     =       num_hidden_layers
						__SCREAMING_SNAKE_CASE		     =       num_attention_heads
						__SCREAMING_SNAKE_CASE		     =       intermediate_size
						__SCREAMING_SNAKE_CASE		     =       hidden_act
						__SCREAMING_SNAKE_CASE		     =       hidden_dropout_prob
						__SCREAMING_SNAKE_CASE		     =       attention_probs_dropout_prob
						__SCREAMING_SNAKE_CASE		     =       max_position_embeddings
						__SCREAMING_SNAKE_CASE		     =       type_vocab_size
						__SCREAMING_SNAKE_CASE		     =       type_sequence_label_size
						__SCREAMING_SNAKE_CASE		     =       initializer_range
						__SCREAMING_SNAKE_CASE		     =       num_choices




	def 						UpperCAmelCase_   (				self    :       int     ) ->			Tuple:
						__SCREAMING_SNAKE_CASE		     =       ids_tensor([self.batch_size, self.seq_length]    ,    self.vocab_size     )

						__SCREAMING_SNAKE_CASE		     =       None
						if self.use_attention_mask:
											__SCREAMING_SNAKE_CASE		     =       random_attention_mask([self.batch_size, self.seq_length]     )

						__SCREAMING_SNAKE_CASE		     =       None
						if self.use_token_type_ids:
											__SCREAMING_SNAKE_CASE		     =       ids_tensor([self.batch_size, self.seq_length]    ,    self.type_vocab_size     )

						__SCREAMING_SNAKE_CASE		     =       AlbertConfig(
						    vocab_size=self.vocab_size    ,    hidden_size=self.hidden_size    ,    num_hidden_layers=self.num_hidden_layers    ,    num_attention_heads=self.num_attention_heads    ,    intermediate_size=self.intermediate_size    ,    hidden_act=self.hidden_act    ,    hidden_dropout_prob=self.hidden_dropout_prob    ,    attention_probs_dropout_prob=self.attention_probs_dropout_prob    ,    max_position_embeddings=self.max_position_embeddings    ,    type_vocab_size=self.type_vocab_size    ,    is_decoder=UpperCAmelCase__    ,    initializer_range=self.initializer_range    ,    )

						return config, input_ids, token_type_ids, attention_mask




	def 						UpperCAmelCase_   (				self    :       Optional[int]     ) ->			Optional[int]:
						__SCREAMING_SNAKE_CASE		     =       self.prepare_config_and_inputs()
						__SCREAMING_SNAKE_CASE		     =       config_and_inputs
						__SCREAMING_SNAKE_CASE		     =       {"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": attention_mask}
						return config, inputs_dict




@require_flax
class 				UpperCamelCase_			(				_A    ,						unittest.TestCase):

	"""simple docstring"""





	snake_case__       :						int					      =    (
	    (
	        FlaxAlbertModel,
	        FlaxAlbertForPreTraining,
	        FlaxAlbertForMaskedLM,
	        FlaxAlbertForMultipleChoice,
	        FlaxAlbertForQuestionAnswering,
	        FlaxAlbertForSequenceClassification,
	        FlaxAlbertForTokenClassification,
	        FlaxAlbertForQuestionAnswering,
	    )
	    if is_flax_available()
	    else ()
	)




	def 						UpperCAmelCase_   (				self    :       int     ) ->			Any:
						__SCREAMING_SNAKE_CASE		     =       FlaxAlbertModelTester(self     )




	@slow
	def 						UpperCAmelCase_   (				self    :       int     ) ->			str:
						for model_class_name in self.all_model_classes:
											__SCREAMING_SNAKE_CASE		     =       model_class_name.from_pretrained("albert-base-v2"     )
											__SCREAMING_SNAKE_CASE		     =       model(np.ones((1, 1)     )     )
											self.assertIsNotNone(UpperCAmelCase__     )




@require_flax
class 				UpperCamelCase_			(				unittest.TestCase):

	"""simple docstring"""





	@slow
	def 						UpperCAmelCase_   (				self    :       Dict     ) ->			int:
						__SCREAMING_SNAKE_CASE		     =       FlaxAlbertModel.from_pretrained("albert-base-v2"     )
						__SCREAMING_SNAKE_CASE		     =       np.array([[0, 3_4_5, 2_3_2, 3_2_8, 7_4_0, 1_4_0, 1_6_9_5, 6_9, 6_0_7_8, 1_5_8_8, 2]]     )
						__SCREAMING_SNAKE_CASE		     =       np.array([[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]     )
						__SCREAMING_SNAKE_CASE		     =       model(UpperCAmelCase__    ,    attention_mask=UpperCAmelCase__     )[0]
						__SCREAMING_SNAKE_CASE		     =       (1, 1_1, 7_6_8)
						self.assertEqual(output.shape    ,    UpperCAmelCase__     )
						__SCREAMING_SNAKE_CASE		     =       np.array(
						    [[[-0.6_513, 1.5_035, -0.2_766], [-0.6_515, 1.5_046, -0.2_780], [-0.6_512, 1.5_049, -0.2_784]]]     )

						self.assertTrue(jnp.allclose(output[:, 1:4, 1:4]    ,    UpperCAmelCase__    ,    atol=1E-4     )     )




"""simple docstring"""







from __future__ import annotations




def      UpperCAmelCase__ (lowerCAmelCase_     ):




					'''simple docstring'''


					__SCREAMING_SNAKE_CASE		     =       str(lowerCAmelCase_     )
					return n == n[::-1]




def      UpperCAmelCase__ (lowerCAmelCase_ = 100_0000     ):




					'''simple docstring'''


					__SCREAMING_SNAKE_CASE		     =       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()))))
