input: from typing import Optional
  
  
  def factorial(n: int) -> Optional[int]:
      """
      Calculate the factorial of a given integer n using recursion.
      
      >>> factorial(5)
      120
      >>> factorial(3)
      6
      >>> factorial(1)
      1
      >>> factorial(0)
      1
      >>> factorial(-1)
      None
      """
      if n < 0:
          return None
      elif n == 0 or n == 1:
          return 1
      else:
          return n * factorial(n - 1)
output:     if n < 0:
          return None
      elif n == 0 or n == 1:
          return 1
      else:
          return n * factorial(n - 1)