output_description: Print the minimum number of elements that needs to be replaced.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      n
      v_1 v_2 ... v_n
attempt: def DistanceFromVV(seq, el):
      """Return the numbers of edits required to make seq into a VV sequences
      using el as the first and second element, respectively.
      """
  
      distA = 0
      distB = 0
      for i in range(0, len(seq), 2):
          if seq[i] != el:
              distA += 1
      for j in range(1, len(seq), 2):
          if seq[j] != el:
              distB += 1
      return (distA, distB)
  
  
  def CountElements(seq):
      """Count the number of occurrences of each element of seq, returning the
      result as a dictionary.
      """
  
      count = {}
      for el in seq:
          if el in count:
              count[el] += 1
          else:
              count[el] = 1
      return count
  
  
  def MinChanges(seq):
      """Return the minimum number of changes which must be made to the given
      sequence in order to make it "VV".
      """
  
      element_count = CountElements(seq)
      elements_descending = sorted(
          element_count, key=lambda key: element_count[key], reverse=True
      )
  
      if len(elements_descending) == 1:
          return len(seq) // 2
  
      best = [len(seq) + 1, len(seq) + 1]
      second_best = [len(seq) + 1, len(seq) + 1]
      best_elements = [-1, -1]
      for el in elements_descending:
          changes = DistanceFromVV(seq, el)
          for i in (0, 1):
              if changes[i] <= best[i]:
                  second_best[i] = best[i]
                  best[i] = changes[i]
                  best_elements[i] = el
              elif changes[i] < second_best[i]:
                  second_best[i] = changes[i]
  
          if best_elements[0] != best_elements[1]:
              if best[0] <= len(seq) // 4 and best[1] <= len(seq) // 4:
                  break
          elif (best[0] <= len(seq) // 4 and second_best[1] <= len(seq) // 4) or (
              best[1] <= len(seq) // 4 and second_best[0] <= len(seq) // 4
          ):
              break
  
      if best_elements[0] != best_elements[1]:
          return sum(best)
      else:
          return min(best[0] + second_best[1], best[1] + second_best[0])
  
  
  lines = sys.stdin.read().split("\n")
  n = int(lines[0])
  entries = lines[1].split(" ")
  v = []
  for e in entries:
      v += [int(e)]
  
  print(MinChanges(v))
  
problem_description: Statement
  
  A sequence a_1,a_2,... ,a_n is said to be /\/\/\/ when the following
  conditions are satisfied:
  
    * For each i = 1,2,..., n-2, a_i = a_{i+2}.
    * Exactly two different numbers appear in the sequence.
  
  You are given a sequence v_1,v_2,...,v_n whose length is even. We would like
  to make this sequence /\/\/\/ by replacing some of its elements. Find the
  minimum number of elements that needs to be replaced.
samples: [{"input": "4\n    3 1 3 2", "output": "1\n    \n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing\none of its elements: for example, replace the fourth element to make it\n3,1,3,1.\n\n* * *"}, {"input": "6\n    105 119 105 119 105 119", "output": "0\n    \n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\n* * *"}, {"input": "4\n    1 1 1 1", "output": "2\n    \n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/."}]