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: # abc111_c.py
  # https://atcoder.jp/contests/abc111/tasks/arc103_a
  
  # C - /\/\/\/ /
  # 実行時間制限: 2 sec / メモリ制限: 1024 MB
  # 配点 : 300点
  
  # 問題文
  # 数列 a1,a2,...,anが以下の条件を満たすとき、 /\/\/\/ と呼ぶことにします。
  #     各 i=1,2,...,n−2について、ai=ai+2
  #     数列に現れる数はちょうど 2種類
  
  # 偶数長の数列 v1,v2,...,vnが与えられます。
  # 要素をいくつか書き換えることでこの数列を /\/\/\/ にしたいです。 書き換える要素の数は最小でいくつになるか求めてください。
  
  # 制約
  #     2≤n≤105
  #     nは偶数
  #     1≤vi≤105
  #     viは整数
  
  # 入力
  # 入力は以下の形式で標準入力から与えられる。
  # n
  # v1 v2 ... vn
  
  # 出力
  # 書き換える要素数の最小値を出力してください。
  
  # 入力例 1
  # 4
  # 3 1 3 2
  
  # 出力例 1
  # 1
  
  # 数列 3,1,3,2は /\/\/\/ ではありませんが、1 要素書き換えることで /\/\/\/ にすることができます。
  # 例えば、4 要素目を書き換えて 3,1,3,1とすればよいです。
  
  # 入力例 2
  # 6
  # 105 119 105 119 105 119
  
  # 出力例 2
  # 0
  
  # 数列 105,119,105,119,105,119は /\/\/\/ です。
  
  # 入力例 3
  # 4
  # 1 1 1 1
  
  # 出力例 3
  # 2
  
  # 数列 1,1,1,1は 1 種類の数からなる数列であるため、 /\/\/\/ ではありません。
  
  
  def calculation(lines):
      n = int(lines[0])
      values = list(map(int, lines[1].split()))
      # n = lines[0]
  
      d_odd = dict()
      d_even = dict()
      for i in range(n):
          value = values[i]
          if i % 2 == 0:
              if value in d_even.keys():
                  d_even[value] += 1
              else:
                  d_even[value] = 1
          else:
              if value in d_odd.keys():
                  d_odd[value] += 1
              else:
                  d_odd[value] = 1
  
      n_even_max1st = 0
      n_even_max2nd = 0
      for key in d_even:
          ma = d_even[key]
          if n_even_max1st < ma:
              key_even = key
              n_even_max2nd = n_even_max1st
              n_even_max1st = ma
  
      n_odd_max1st = 0
      n_odd_max2nd = 0
      for key in d_odd:
          ma = d_odd[key]
          if n_odd_max1st < ma:
              key_odd = key
              n_odd_max2nd = n_odd_max1st
              n_odd_max1st = ma
  
      # 変数初期化
      result = 0
  
      # 奇数/偶数の最大値が異なる場合
      if key_even != key_odd:
          print("if d_even[key_even] != d_odd[key_odd]:")
          result += int(n / 2) - n_even_max1st
          result += int(n / 2) - n_odd_max1st
      else:
          m = max(n_even_max2nd, n_odd_max2nd)
          result += int(n / 2) - n_even_max1st
          result += int(n / 2) - m
  
      return [result]
  
  
  # 引数を取得
  def get_input_lines(lines_count):
      lines = list()
      for _ in range(lines_count):
          lines.append(input())
      return lines
  
  
  # テストデータ
  def get_testdata(pattern):
      if pattern == 1:
          lines_input = ["4", "3 1 3 2"]
          lines_export = [1]
      if pattern == 2:
          lines_input = ["6", "105 119 105 119 105 119"]
          lines_export = [0]
      if pattern == 3:
          lines_input = ["4", "1 1 1 1"]
          lines_export = [2]
      return lines_input, lines_export
  
  
  # 動作モード判別
  def get_mode():
      import sys
  
      args = sys.argv
      if len(args) == 1:
          mode = 0
      else:
          mode = int(args[1])
      return mode
  
  
  # 主処理
  def main():
      import time
  
      started = time.time()
      mode = get_mode()
      if mode == 0:
          lines_input = get_input_lines(2)
      else:
          lines_input, lines_export = get_testdata(mode)
  
      lines_result = calculation(lines_input)
  
      for line_result in lines_result:
          print(line_result)
  
      # if mode > 0:
      #     print(f'lines_input=[{lines_input}]')
      #     print(f'lines_export=[{lines_export}]')
      #     print(f'lines_result=[{lines_result}]')
      #     if lines_result == lines_export:
      #         print('OK')
      #     else:
      #         print('NG')
      # finished = time.time()
      # duration = finished - started
      # print(f'duration=[{duration}]')
  
  
  # 起動処理
  if __name__ == "__main__":
      main()
  
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 /\\/\\/\\/."}]