input: Write a function to count the number of unique elements in an integer array. The function should return an integer representing the number of unique elements in the input array. If the input array is empty, the function should return 0.
  
  def num_unique_elements(arr):
      if not arr:
          return 0
      unique_elements = set(arr)
      return len(unique_elements)
  
  assert num_unique_elements([1, 2, 3, 2, 1, 4, 7, 8, 9, 8])==6
  assert num_unique_elements([1, 1, 1, 1, 1])==1
  assert num_unique_elements([])==0
  assert num_unique_elements([5, 4, 3, 2, 1, 0])==6
  assert num_unique_elements([10, 10, 10, 20, 20, 30, 30, 40, 40])==4
output: def num_unique_elements(arr):
      if not arr:
          return 0
      unique_elements = set(arr)
      return len(unique_elements)