input: Write a function called `can_sort_by_shifts` that determines if a list can be sorted into non-decreasing order by performing any number of right shifts on the list. The function should return `True` if it is possible, otherwise `False`. If the list is empty, the function should return `True`.
  
  def can_sort_by_shifts(arr):
      if not arr:
          return True
      n = len(arr)
      rotations = 0
      for i in range(1, n):
          if arr[i] < arr[i-1]:
              rotations += 1
      return rotations <= 1
  
  assert can_sort_by_shifts([3, 4, 5, 1, 2]) == True
  assert can_sort_by_shifts([3, 5, 10, 1, 2]) == True
  assert can_sort_by_shifts([4, 3, 1, 2]) == False
  assert can_sort_by_shifts([3, 5, 4, 1, 2]) == False
  assert can_sort_by_shifts([]) == True
output: def can_sort_by_shifts(arr):
      if not arr:
          return True
      n = len(arr)
      rotations = 0
      for i in range(1, n):
          if arr[i] < arr[i-1]:
              rotations += 1
      return rotations <= 1