output_description: Print the number of the Shichi-Go-San numbers between 1 and N (inclusive).
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
attempt: inn = int(input())
  
  result = 0
  
  if inn < 357:
      print(0)
  
  elif inn < 99999999:
      for i in range(357, inn, 2):
  
          str_i = str(i)
  
          num_3 = 0
          num_5 = 0
          num_7 = 0
  
          # check_357 = [i in ['3','5','7'] for i in str(i)]
          # if sum(check_357) == len(str_i):
  
          # if '3' in str_i and '5' in str_i and '7' in str_i:
          # if re.sub(r'3|5|7', '', str_i) == '':
  
          for j in str_i:
              if num_3 == 0 and j == "3":
                  num_3 = 1
  
              elif num_5 == 0 and j == "5":
                  num_5 = 1
  
              elif num_7 == 0 and j == "7":
                  num_7 = 1
  
              elif j in ["0", "1", "2", "4", "6", "8", "9"]:
                  num_3 = 0
                  break
  
              # if '0' not in str_i and '1' not in str_i and '2' not in str_i and '4' not in str_i and '6' not in str_i and '8' not in str_i and '9' not in str_i:
  
          if num_3 == 1 and num_5 == 1 and num_7 == 1:
              result += 1
  
      print(result)
  
  else:
      result = 8334
      if inn >= 333333357:
          for i in range(333333357, inn if inn <= 377777776 else 377777776, 2):
  
              str_i = str(i)
  
              if "3" in str_i and "5" in str_i and "7" in str_i:
                  if (
                      "0" not in str_i
                      and "1" not in str_i
                      and "2" not in str_i
                      and "4" not in str_i
                      and "6" not in str_i
                      and "8" not in str_i
                      and "9" not in str_i
                  ):
  
                      result += 1
  
      if inn >= 533333337:
          for i in range(533333337, inn if inn <= 577777774 else 577777774, 2):
  
              str_i = str(i)
  
              if "3" in str_i and "5" in str_i and "7" in str_i:
                  if (
                      "0" not in str_i
                      and "1" not in str_i
                      and "2" not in str_i
                      and "4" not in str_i
                      and "6" not in str_i
                      and "8" not in str_i
                      and "9" not in str_i
                  ):
  
                      result += 1
  
      if inn >= 733333335:
          for i in range(733333335, inn if inn <= 777777754 else 777777754, 2):
  
              str_i = str(i)
  
              if "3" in str_i and "5" in str_i and "7" in str_i:
                  if (
                      "0" not in str_i
                      and "1" not in str_i
                      and "2" not in str_i
                      and "4" not in str_i
                      and "6" not in str_i
                      and "8" not in str_i
                      and "9" not in str_i
                  ):
  
                      result += 1
  
      print(result)
  
problem_description: Statement
  
  You are given an integer N. Among the integers between 1 and N (inclusive),
  how many _Shichi-Go-San numbers_ (literally "Seven-Five-Three numbers") are
  there?
  
  Here, a Shichi-Go-San number is a positive integer that satisfies the
  following condition:
  
    * When the number is written in base ten, each of the digits `7`, `5` and `3` appears at least once, and the other digits never appear.
samples: [{"input": "575", "output": "4\n    \n\nThere are four Shichi-Go-San numbers not greater than 575: 357, 375, 537 and\n573.\n\n* * *"}, {"input": "3600", "output": "13\n    \n\nThere are 13 Shichi-Go-San numbers not greater than 3600: the above four\nnumbers, 735, 753, 3357, 3375, 3537, 3557, 3573, 3575 and 3577.\n\n* * *"}, {"input": "999999999", "output": "26484"}]