





from __future__ import annotations

import os





class UpperCAmelCase_							:
  __lowerCAmelCase      :	Optional[int]  	=      (
      """High card""",
      """One pair""",
      """Two pairs""",
      """Three of a kind""",
      """Straight""",
      """Flush""",
      """Full house""",
      """Four of a kind""",
      """Straight flush""",
      """Royal flush""",
  )

  __lowerCAmelCase      :	List[Any]  	=      (
      """""",  # placeholder as tuples are zero-indexed
      """One""",
      """Two""",
      """Three""",
      """Four""",
      """Five""",
      """Six""",
      """Seven""",
      """Eight""",
      """Nine""",
      """Ten""",
      """Jack""",
      """Queen""",
      """King""",
      """Ace""",
  )


  def __init__(       self   ,__snake_case   ):



       """simple docstring"""





       if not isinstance(lowercase_   ,lowercase_   ):
            A_					      =  f'Hand should be of type \'str\': {hand!r}'
            raise TypeError(lowercase_   )
       # split removes duplicate whitespaces so no need of strip
       if len(hand.split(''' '''   )   ) != 5:
            A_					      =  f'Hand should contain only 5 cards: {hand!r}'
            raise ValueError(lowercase_   )
       A_					      =  hand
       A_					      =  0
       A_					      =  0
       A_					      =  self._internal_state()
       A_					      =  self._get_hand_type()
       A_					      =  self._card_values[0]


  @property
  def 	__UpperCAmelCase    (       self   ):



       """simple docstring"""





       return self._hand


  def 	__UpperCAmelCase    (       self   ,__snake_case   ):



       """simple docstring"""





       if self._hand_type > other._hand_type:
            return "Win"
       elif self._hand_type < other._hand_type:
            return "Loss"
       elif self._first_pair == other._first_pair:
            if self._second_pair == other._second_pair:
                 return self._compare_cards(lowercase_   )
            else:
                 return "Win" if self._second_pair > other._second_pair else "Loss"
       return "Win" if self._first_pair > other._first_pair else "Loss"


  def 	__UpperCAmelCase    (       self   ):



       """simple docstring"""





       A_					      =  PokerHand._HAND_NAME[self._hand_type - 1_4]
       A_					      =  PokerHand._CARD_NAME[self._high_card]
       A_					      =  PokerHand._CARD_NAME[self._first_pair]
       A_					      =  PokerHand._CARD_NAME[self._second_pair]
       if self._hand_type in [2_2, 1_9, 1_8]:
            return name + f', {high}-high'
       elif self._hand_type in [2_1, 1_7, 1_5]:
            return name + f', {paira}s'
       elif self._hand_type in [2_0, 1_6]:
            A_					      =  '''over''' if self._hand_type == 2_0 else '''and'''
            return name + f', {paira}s {join} {paira}s'
       elif self._hand_type == 2_3:
            return name
       else:
            return name + f', {high}'


  def 	__UpperCAmelCase    (       self   ,__snake_case   ):



       """simple docstring"""





       for index, card_value in enumerate(self._card_values   ):
            if card_value != other._card_values[index]:
                 return "Win" if card_value > other._card_values[index] else "Loss"
       return "Tie"


  def 	__UpperCAmelCase    (       self   ):



       """simple docstring"""





       if self._is_flush():
            if self._is_five_high_straight() or self._is_straight():
                 return 2_3 if sum(self._card_values   ) == 6_0 else 2_2
            return 1_9
       elif self._is_five_high_straight() or self._is_straight():
            return 1_8
       return 1_4 + self._is_same_kind()


  def 	__UpperCAmelCase    (       self   ):



       """simple docstring"""





       return len(self._card_suit   ) == 1


  def 	__UpperCAmelCase    (       self   ):



       """simple docstring"""





       if sorted(self._card_values   ) == [2, 3, 4, 5, 1_4]:
            if self._card_values[0] == 1_4:
                 # Remember, our list is sorted in reverse order
                 A_					      =  self._card_values.pop(0   )
                 self._card_values.append(lowercase_   )
            return True
       return False


  def 	__UpperCAmelCase    (       self   ):



       """simple docstring"""





       for i in range(4   ):
            if self._card_values[i] - self._card_values[i + 1] != 1:
                 return False
       return True


  def 	__UpperCAmelCase    (       self   ):



       """simple docstring"""





       A_					      =  0
       for i in range(4   ):
            # Compare two cards at a time, if they are same increase 'kind',
            # add the value of the card to val1, if it is repeating again we
            # will add 2 to 'kind' as there are now 3 cards with same value.
            # If we get card of different value than val1, we will do the same
            # thing with val2
            if self._card_values[i] == self._card_values[i + 1]:
                 if not vala:
                      A_					      =  self._card_values[i]
                      kind += 1
                 elif vala == self._card_values[i]:
                      kind += 2
                 elif not vala:
                      A_					      =  self._card_values[i]
                      kind += 1
                 elif vala == self._card_values[i]:
                      kind += 2
        # For consistency in hand type (look at note in _get_hand_type function)
       A_					      =  kind + 2 if kind in [4, 5] else kind
       # first meaning first pair to compare in 'compare_with'
       A_					      =  max(lowercase_   ,lowercase_   )
       A_					      =  min(lowercase_   ,lowercase_   )
       # If it's full house (three count pair + two count pair), make sure
       # first pair is three count and if not then switch them both.
       if kind == 6 and self._card_values.count(lowercase_   ) != 3:
            A_					      =  second, first
       A_					      =  first
       A_					      =  second
       return kind


  def 	__UpperCAmelCase    (       self   ):



       """simple docstring"""





       A_					      =  {"T": "10", "J": "11", "Q": "12", "K": "13", "A": "14"}
       A_					      =  self._hand.translate(str.maketrans(lowercase_   )   ).split()
       A_					      =  [int(card[:-1]   ) for card in new_hand]
       A_					      =  {card[-1] for card in new_hand}
       return sorted(lowercase_   ,reverse=lowercase_   ), card_suit


  def __repr__(       self   ):



       """simple docstring"""





       return f'{self.__class__}("{self._hand}")'


  def __str__(       self   ):



       """simple docstring"""





       return self._hand


  def __eq__(       self   ,__snake_case   ):



       """simple docstring"""





       if isinstance(lowercase_   ,lowercase_   ):
            return self.compare_with(lowercase_   ) == "Tie"
       return NotImplemented


  def __lt__(       self   ,__snake_case   ):



       """simple docstring"""





       if isinstance(lowercase_   ,lowercase_   ):
            return self.compare_with(lowercase_   ) == "Loss"
       return NotImplemented


  def __le__(       self   ,__snake_case   ):



       """simple docstring"""





       if isinstance(lowercase_   ,lowercase_   ):
            return self < other or self == other
       return NotImplemented


  def __gt__(       self   ,__snake_case   ):



       """simple docstring"""





       if isinstance(lowercase_   ,lowercase_   ):
            return not self < other and self != other
       return NotImplemented


  def __ge__(       self   ,__snake_case   ):



       """simple docstring"""





       if isinstance(lowercase_   ,lowercase_   ):
            return not self < other
       return NotImplemented




  def __hash__(       self   ):



       """simple docstring"""





       return object.__hash__(self   )




def     UpperCAmelCase_						(						)  ->							int:
     '''simple docstring'''


     A_					      =  0
     A_					      =  os.path.abspath(os.path.dirname(lowercase_							)							)
     A_					      =  os.path.join(lowercase_     ,	'''poker_hands.txt'''							)
     with open(lowercase_							) as file_hand:
          for line in file_hand:
               A_					      =  line[:14].strip()
               A_					      =  line[15:].strip()
               A_					      =  PokerHand(lowercase_							), PokerHand(lowercase_							)
               A_					      =  player.compare_with(lowercase_							)
               if output == "Win":
                    answer += 1
     return answer


if __name__ == "__main__":
      solution()










def     UpperCAmelCase_						(						_UpperCAmelCase       :int = 1000							)  ->							int:
     '''simple docstring'''


     A_					      =					[0, 3, 3, 5, 4, 4, 3, 5, 5, 4, 3, 6, 6, 8, 8, 7, 7, 9, 8, 8]
     # number of letters in twenty, thirty, ..., ninety (0 for numbers less than
     # 20 due to inconsistency in teens)
     A_					      =					[0, 0, 6, 6, 5, 5, 5, 7, 6, 6]

     A_					      =					0

     for i in range(1     ,	n + 1							):
          if i < 1000:
               if i >= 100:
                    # add number of letters for "n hundred"
                    count += ones_counts[i // 100] + 7

                    if i % 100 != 0:
                         # add number of letters for "and" if number is not multiple
                         # of 100
                         count += 3

               if 0 < i % 100 < 20:
                    # add number of letters for one, two, three, ..., nineteen
                    # (could be combined with below if not for inconsistency in
                    # teens)
                    count += ones_counts[i % 100]
               else:
                    # add number of letters for twenty, twenty one, ..., ninety
                    # nine
                    count += ones_counts[i % 10]
                    count += tens_counts[(i % 100 - i % 10) // 10]
          else:
               count += ones_counts[i // 1000] + 8
     return count


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



