#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=nxt();
    vector <int> v(n);
    generate(all(v),nxt);
    map <int,int> m1,m2;
    for(int i=0;i<n;i+=2)
        m1[v[i]]++;
    for(int i=1;i<n;i+=2)
        m2[v[i]]++;
    map <int,set <int>,greater <int> > m3,m4;
    set <int> r;
    for(auto it=m1.begin();it!=m1.end();it++)
    {
        if(m3.find(it->second)==m3.end())
            m3[it->second]=r;
        m3[it->second].insert(it->first);
    }
    for(auto it=m2.begin();it!=m2.end();it++)
    {
        if(m4.find(it->second)==m4.end())
            m4[it->second]=r;
        m4[it->second].insert(it->first);
    }
    int test=INT_MAX;
    for(auto it=m1.begin();it!=m1.end();it++)
    {
        int cost=n/2-it->second;
        if(m2.find(it->first)!=m2.end())
        {
            m4[m2[it->first]].erase(it->first);
            if(m4[m2[it->first]].size()==0)
                m4.erase(m2[it->first]);
        }
        int temp=n/2;
        if(m4.size())
        {
            temp=min(temp,n/2-(m4.begin())->first);
        }
        test=min(test,cost+temp);
        if(m4.find(m2[it->first])==m4.end())
            m4[m2[it->first]]=r;
        m4[m2[it->first]].insert(it->first);
    }

    for(auto it=m2.begin();it!=m2.end();it++)
    {
        int cost=n/2-it->second;
        if(m1.find(it->first)!=m1.end())
        {
            m3[m1[it->first]].erase(it->first);
            if(m3[m1[it->first]].size()==0)
                m3.erase(m1[it->first]);
        }
        int temp=n/2;
        if(m3.size())
        {
            temp=min(temp,n/2-(m3.begin())->first);
        }
        test=min(test,cost+temp);
        if(m3.find(m1[it->first])==m3.end())
            m3[m1[it->first]]=r;
        m3[m1[it->first]].insert(it->first);
    }

    cout<<test<<endl;

    
    
    
    return 0;   
}




 
 


Measured memory_bytes: 19456