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++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

/*
This code By @1353055672(Ligen)
[Warning]You're not excepted to understand this code!
RP++
*/
//#pragma GCC optimize(3)
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<stack>
#define ll long long
#define ull unsigned long long
#define mn 200020
#define mod (int)(1e9+7)
#define inf (1<<30)
#define FOR(a,b,c) for (register ll a=b;a<=c;a++)
#define FORD(a,b,c) for (register ll a=b;a>=c;a--)
using namespace std;
inline ll read(){
    ll x=0,f=1;
    char c=getchar();
    while (c<'0'||c>'9'){
        if (c=='-')f=-1;
        c=getchar();
    }
    while (c>='0'&&c<='9'){
        x=x*10+c-'0';
        c=getchar();
    }
    return x*f;
}
inline void writeln(ll a){
    if(a==0){puts("0");return;}
    if(a<0)putchar('-'),a=-a;
    char c1[120];
    int h=0;
    while(a)c1[++h]=a%10+'0',a/=10;
    FORD(i,h,1)putchar(c1[i]);putchar('\n');
    return;
}
inline ll Max(ll a,ll b){return (a>b)?a:b;}
inline ll Min(ll a,ll b){return (a<b)?a:b;}
inline ll Abs(ll x){return (x<0)?-x:x;}
inline void Swap(ll &x,ll &y){ll t=x;x=y;y=t;}
int n,a[mn],v1[mn],v2[mn],m1,m2,mi1,mi2,n1,n2,ni1,ni2;
int main(){
	n=read();
	ll ans=0;
	FOR(i,1,n){
		a[i]=read();
		if(i%2){v1[a[i]]++;if(v1[a[i]]>=m1){
//			mi1=m1,ni1=n1;
			m1=v1[a[i]],n1=a[i];
		}else if(v1[a[i]]>mi1)mi1=v1[a[i]],ni1=n1;}
		else{
		v2[a[i]]++;if(v2[a[i]]>=m2){
//			mi2=m2,ni2=n2;
			m2=v2[a[i]],n2=a[i];
		}else if(v2[a[i]]>mi2)mi2=v2[a[i]],ni2=n2;}
	}
	if(n1==n2)//writeln(Min(n-m1-mi2,n-mi1-m2));
	{
		ans=2147483647;
//		if(n1!=ni2)
		ans=Min(ans,n-m1-mi2);
//		if(n2!=ni1)
		ans=Min(ans,n-mi1-m2);
//		if(ni1!=ni2)ans=Min(ans,n-mi1-mi2);
//		if(n1==n2&&n2==ni1&&ni1==ni2)ans=n/2;
		writeln(ans);
	}
	else writeln(n-m1-m2);
	return 0;
}