


from collections import Counter
import datasets
import transformers
from transformers.convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS

from transformers.utils import logging

logging.set_verbosity_info()

__SCREAMING_SNAKE_CASE	:							Optional[int]           =  {
    name: (getattr(transformers, name), getattr(transformers, name + '''Fast''')) for name in SLOW_TO_FAST_CONVERTERS
}

__SCREAMING_SNAKE_CASE	:							List[Any]           =  datasets.load_dataset('''xnli''', split='''test+validation''')

__SCREAMING_SNAKE_CASE	:							List[str]           =  0
__SCREAMING_SNAKE_CASE	:							Any           =  0
__SCREAMING_SNAKE_CASE	:							Optional[int]           =  0
__SCREAMING_SNAKE_CASE	:							List[Any]           =  0

def 		snake_case_   (				lowercase__     :    List[str]       ,     lowercase__     :    List[str]       ,     lowercase__     :    int       ,     lowercase__     :    List[Any]     ):






				'''simple docstring'''






				if spm_diff == list(reversed(lowercase__     )     ):
								# AAA -> AA+A vs A+AA case.
								return True
				elif len(lowercase__     ) == len(lowercase__     ) and fast.decode(lowercase__     ) == fast.decode(lowercase__     ):
								# Second order OK
								# Barrich -> Barr + ich vs Bar + rich
								return True
				_lowerCAmelCase  						=slow.encode(slow.decode(lowercase__     )     )
				_lowerCAmelCase  						=fast.encode(fast.decode(lowercase__     )     )
				if spm_reencoded != spm_diff and spm_reencoded == tok_reencoded:
								# Type 3 error.
								# Snehagatha ->
								#       Sne, h, aga, th, a
								#       Sne, ha, gat, ha
								# Encoding the wrong with sp does not even recover what spm gave us
								# It fits tokenizer however...
								return True
				return False

def 		snake_case_   (				lowercase__     :    List[str]       ,     lowercase__     :    Dict       ,     lowercase__     :    Tuple     ):






				'''simple docstring'''






				_lowerCAmelCase  						=fast.encode_plus(lowercase__     )[0]
				_lowerCAmelCase  						=enc.offsets
				_lowerCAmelCase						,							_lowerCAmelCase  						=offsets[idx], offsets[idx - 1]
				if curr is not None and line[curr[0] : curr[1]] == "\u200f":
								return True
				if prev is not None and line[prev[0] : prev[1]] == "\u200f":
								return True

def 		snake_case_   (				lowercase__     :    int       ,     lowercase__     :    Any       ,     lowercase__     :    str       ,     lowercase__     :    List[Any]       ,     lowercase__     :    str     ):






				'''simple docstring'''






				for i, (spm_id, tok_id) in enumerate(zip(lowercase__       ,     lowercase__     )     ):
								if spm_id != tok_id:
												break
				_lowerCAmelCase  						=i
				for i, (spm_id, tok_id) in enumerate(zip(reversed(lowercase__     )       ,     reversed(lowercase__     )     )     ):
								if spm_id != tok_id:
												break
				_lowerCAmelCase  						=len(lowercase__     ) - i

				_lowerCAmelCase  						=spm_ids[first:last]
				_lowerCAmelCase  						=tok_ids[first:last]

				if check_diff(lowercase__       ,     lowercase__       ,     lowercase__       ,     lowercase__     ):
								return True

				if check_LTR_mark(lowercase__       ,     lowercase__       ,     lowercase__     ):
								return True

				if last - first > 5:
								# We might have twice a single problem, attempt to subdivide the disjointed tokens into smaller problems
								_lowerCAmelCase  						=Counter(spm_ids[first:last]     )
								_lowerCAmelCase  						=Counter(tok_ids[first:last]     )

								_lowerCAmelCase  						={spm_ for (spm_, si) in spms.items() if toks.get(spm_       ,     0     ) == si}
								_lowerCAmelCase  						=3
								for i in range(last - first - min_width     ):
												if all(spm_ids[first + i + j] in removable_tokens for j in range(lowercase__     )     ):
																_lowerCAmelCase  						=[
																    k
																    for k in range(last - first - min_width     )
																    if tok_ids[first + k : first + k + min_width] == spm_ids[first + i : first + i + min_width]
																]
																for j in possible_matches:
																				if check_diff(spm_ids[first : first + i]       ,     tok_ids[first : first + j]       ,     lowercase__       ,     lowercase__     ) and check_details(
																				    lowercase__       ,     spm_ids[first + i : last]       ,     tok_ids[first + j : last]       ,     lowercase__       ,     lowercase__       ,     ):
																								return True

				print(f"Spm: {[fast.decode([spm_ids[i]]     ) for i in range(lowercase__       ,     lowercase__     )]}"     )
				try:
								print(f"Tok: {[fast.decode([tok_ids[i]]     ) for i in range(lowercase__       ,     lowercase__     )]}"     )
				except Exception:
								pass

				_lowerCAmelCase  						=fast.decode(spm_ids[:first]     )
				_lowerCAmelCase  						=fast.decode(spm_ids[last:]     )
				_lowerCAmelCase  						=fast.decode(spm_ids[first:last]     )
				print()
				print(lowercase__     )
				return False

def 		snake_case_   (				lowercase__     :    Any       ,     lowercase__     :    List[Any]       ,     lowercase__     :    Optional[int]     ):






				'''simple docstring'''






				global perfect
				global imperfect
				global wrong
				global total

				_lowerCAmelCase  						=slow.encode(lowercase__     )
				_lowerCAmelCase  						=fast.encode(lowercase__     )

				_lowerCAmelCase  						=False
				total += 1

				if slow_ids != fast_ids:
								if check_details(lowercase__       ,     lowercase__       ,     lowercase__       ,     lowercase__       ,     lowercase__     ):
												_lowerCAmelCase  						=True
												imperfect += 1
								else:
												wrong += 1
				else:
								perfect += 1

				if total % 1_00_00 == 0:
								print(f"({perfect} / {imperfect} / {wrong} ----- {perfect + imperfect + wrong})"     )

				if skip_assert:
								return

				assert (
				    slow_ids == fast_ids
				), f"line {text} : \n\n{slow_ids}\n{fast_ids}\n\n{slow.tokenize(lowercase__     )}\n{fast.tokenize(lowercase__     )}"

def 		snake_case_   (				lowercase__     :    Union[str, Any]       ,     lowercase__     :    Any     ):






				'''simple docstring'''






				global batch_total
				for i in range(len(lowercase__     )     ):
								# premise, all languages
								for text in dataset[i]["premise"].values():
												test_string(lowercase__       ,     lowercase__       ,     lowercase__     )

								# hypothesis, all languages
								for text in dataset[i]["hypothesis"]["translation"]:
												test_string(lowercase__       ,     lowercase__       ,     lowercase__     )


if __name__ == "__main__":
		for name, (slow_class, fast_class) in TOKENIZER_CLASSES.items():
				__SCREAMING_SNAKE_CASE	:							Any           =  list(slow_class.max_model_input_sizes.keys())
				for checkpoint in checkpoint_names:
						__SCREAMING_SNAKE_CASE	:							Optional[int]           =  0
						__SCREAMING_SNAKE_CASE	:							str           =  0
						__SCREAMING_SNAKE_CASE	:							Optional[int]           =  0
						__SCREAMING_SNAKE_CASE	:							Any           =  0

						print(F'========================== Checking {name}: {checkpoint} ==========================')
						__SCREAMING_SNAKE_CASE	:							str           =  slow_class.from_pretrained(checkpoint, force_download=True)
						__SCREAMING_SNAKE_CASE	:							Dict           =  fast_class.from_pretrained(checkpoint, force_download=True)
						test_tokenizer(slow, fast)
						print(F'Accuracy {perfect * 100 / total:.2f}')





from math import floor, sqrt

def 		snake_case_   (				lowercase__     :    int     ):






				'''simple docstring'''






				_lowerCAmelCase  						=0.0
				_lowerCAmelCase  						=1.0
				_lowerCAmelCase  						=int(sqrt(lowercase__     )     )
				_lowerCAmelCase  						=root
				_lowerCAmelCase  						=0
				while integer_part != 2 * root:
								_lowerCAmelCase  						=denominator * integer_part - numerator
								_lowerCAmelCase  						=(n - numerator**2) / denominator
								_lowerCAmelCase  						=int((root + numerator) / denominator     )
								period += 1
				return period

def 		snake_case_   (				lowercase__     :    int = 1_00_00     ):






				'''simple docstring'''






				_lowerCAmelCase  						=0
				for i in range(2       ,     n + 1     ):
								_lowerCAmelCase  						=sqrt(lowercase__     )
								if sr - floor(lowercase__     ) != 0 and continuous_fraction_period(lowercase__     ) % 2 == 1:
												count_odd_periods += 1
				return count_odd_periods


if __name__ == "__main__":
		print(F'{solution(int(input().strip()))}')

