input: from typing import List
  
  def calculate_minimum_operations_to_draw_y(grid: List[List[int]]) -> int:
      """
      You have a square grid of size n x n where n is an odd number. Each element in the grid is either 0, 1, or 2.
  
      A cell is considered part of the Letter Y if it belongs to one of these categories:
  
      The diagonal from the upper-left corner to the center of the grid.
      The diagonal from the upper-right corner to the center of the grid.
      The vertical line from the center to the bottom edge of the grid.
      The Letter Y is correctly represented on the grid if:
  
      All cells in the Y have the same value.
      All cells not in the Y have the same value.
      The values in the Y are distinct from those not in the Y.
      Find the fewest operations required to correctly display the letter Y on the grid, with each operation allowing you to change the value of any cell to 0, 1, or 2.
  
      Examples:
      >>> grid = [[1,2,2],[1,1,0],[0,1,0]]
      3
      >>> grid = [[0,1,0,1,0],[2,1,0,1,2],[2,2,2,0,1],[2,2,2,2,2],[2,1,2,2,2]]
      12
  
      Constraints:
      3 <= n <= 49
      n == grid.length == grid[i].length
      0 <= grid[i][j] <= 2
      n is an odd number.
      """
output:     
      n = len(grid)
      center = n // 2
  
      # Collect values in the Y and not in the Y
      y_values = []
      non_y_values = []
  
      for i in range(n):
          for j in range(n):
              if i == j or i + j == n - 1 or (j == center and i >= center):
                  y_values.append(grid[i][j])
              else:
                  non_y_values.append(grid[i][j])
  
      min_operations = float('inf')
  
      # Try each possible value for Y and non-Y, and calculate operations needed
      for y_val in range(3):
          for non_y_val in range(3):
              if y_val == non_y_val:
                  continue
  
              y_operations = sum(1 for val in y_values if val != y_val)
              non_y_operations = sum(1 for val in non_y_values if val != non_y_val)
              total_operations = y_operations + non_y_operations
  
              min_operations = min(min_operations, total_operations)
  
      return min_operations
  