input: 
  from typing import List
  
  def gini_coefficient(x: List[int]) -> float:
      """Calculate the Gini Coefficient of a given dataset.
      >>> gini_coefficient([2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 21])
      0.605
      """
  
output:     n = len(x)
      if n == 0:
          return 0.0
      x.sort()
      total_sum = sum(x)
      lorenz_curve_area = 0.0
      for i in range(n):
          lorenz_curve_area += (2 * (i + 1) - n - 1) * x[i]
      gini = lorenz_curve_area / (n * total_sum)
      return gini