Problem:
Score : 300 points

Problem 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.

Constraints

2 \leq n \leq 10^5

n is even.

1 \leq v_i \leq 10^5

v_i is an integer.

Input

Input is given from Standard Input in the following format:

n
v_1 v_2 ... v_n

Output

Print the minimum number of elements that needs to be replaced.

Sample Input 1

4
3 1 3 2

Sample Output 1

1

The sequence 3,1,3,2 is not /\/\/\/, but we can make it /\/\/\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.

Sample Input 2

6
105 119 105 119 105 119

Sample Output 2

0

The sequence 105,119,105,119,105,119 is /\/\/\/.

Sample Input 3

4
1 1 1 1

Sample Output 3

2

The elements of the sequence 1,1,1,1 are all the same, so it is not /\/\/\/.

Solution in C++ (GCC 9.2.1) (judge verdict: Wrong Answer)

/**
*    author:  yuya1234
*    created: 03.09.2020 13:17:54
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
long double eps = 1.0E-14;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define FORV(i,v) for(auto i=v.begin(); i!=v.end();i++)

#define SORT(s) sort((s).begin(),(s).end())
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define SZ(x) ((int)(x).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<class T>T lcm(T a,T b){return gcd(a,b)*(a/gcd(a,b))*(b/gcd(a,b));}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  //cout<<fixed<<setprecision(15);

  int n;
  cin>>n;

  int *a=new int[100001];
  int *b=new int[100001];

  REP(i,100001)
  {
    a[i]=b[i]=0;
  }

  int tmp;
  REP(i,n)
  {
    cin>>tmp;
    if(i%2==0)a[tmp]++;
    else b[tmp]++;
  }

  int max11,max12,max21,max22;
  max11=max12=max21=max22=0;

  int idx11,idx12,idx21,idx22;
  idx11=idx12=idx21=idx22=0;

  FOR(i,1,100000)
  {
    if(chmax(max11,a[i]))idx11=i;
    else if(chmax(max21,a[i]))idx21=i;
  }

  FOR(i,1,100000)
  {
    if(chmax(max12,b[i]))idx12=i;
    else if(chmax(max22,b[i]))idx22=i;
  }

  int ans=0;
  if(idx11!=idx12)ans=n-max11-max12;
  else if(max11==max21 || max12==max22)ans=n-max11-max12;
  else ans=min(n-max11-max22,n-max21-max12);

  cout<<ans<<endl;



  return 0;
}