input: Write a function that determines whether it is possible to sort an array in non-decreasing order by performing any number of right shift operations on the given array. Return True if it is possible, otherwise return False. If the given array is empty, return True.
  
  assert sort_by_shift([3, 4, 5, 1, 2])==True
  assert sort_by_shift([3, 5, 10, 1, 2])==True
  assert sort_by_shift([4, 3, 1, 2])==False
  assert sort_by_shift([3, 5, 4, 1, 2])==False
  assert sort_by_shift([])==True
output: def sort_by_shift(arr):
      if not arr:
          return True
      n = len(arr)
      count = 0
      for i in range(1, n):
          if arr[i] < arr[i - 1]:
              count += 1
      return count <= 1