def        lowerCAmelCase_			(					__A,  __A,  __A,  __A,  __A,  __A							)					->    Tuple:







      '''simple docstring'''


      if index == r:
            for j in range(__A							):
                  print(data[j],  end=" "							)
            print(" "							)
            return
      #  When no more elements are there to put in data[]
      if i >= n:
            return
      # current is included, put next at next location
      UpperCAmelCase__								=  arr[i]
      combination_util(__A,  __A,  __A,  index + 1,  __A,  i + 1							)
      # current is excluded, replace it with
      # next (Note that i+1 is passed, but
      # index is not changed)
      combination_util(__A,  __A,  __A,  __A,  __A,  i + 1							)
      # The main function that prints all combinations
      # of size r in arr[] of size n. This function
      # mainly uses combinationUtil()




def        lowerCAmelCase_			(					__A,  __A,  __A							)					->    Dict:







      '''simple docstring'''


      UpperCAmelCase__								=  [0] * r
      # Print all combination using temporary array 'data[]'
      combination_util(__A,  __A,  __A,  0,  __A,  0							)


if __name__ == "__main__":
      # Driver code to check the function above
      UpperCamelCase__    							= [1_0, 2_0, 3_0, 4_0, 5_0]
      print_combination(arr, len(arr), 3)
      # This code is contributed by Ambuj sahu




from __future__ import annotations




def        lowerCAmelCase_			(					__A							)					->    bool:







      '''simple docstring'''


      UpperCAmelCase__								=  str(__A							)
      return n == n[::-1]




def        lowerCAmelCase_			(					__A = 1_000_000							)					->    Optional[int]:







      '''simple docstring'''


      UpperCAmelCase__								=  0

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


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



