#include <bits/stdc++.h>
using namespace std;
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ll long long
#define range(a) a.begin(), a.end()
#define FASTCIN ios::sync_with_stdio(false); cin.tie(0);
const int mod = 1e9 + 7;
template<typename T> void printVector(const T& a, int type = 0, int left = -1, int right = -1) { if (left != -1 && right != -1) { for (int i = left; i < right; i++) { cout << a[i] << " "; if (type == 1) { cout << endl; } } if (type == 0) { cout << endl; } return; } for (auto it : a) { cout << it << " "; if (type == 1) { cout << endl; } } if (type == 0) { cout << endl; } }
inline int charToInt(char c, char base = 'a') { if (base == '-') { return (int)c; } return (int)(c - base); }
inline char intToChar(int i, char base = 'a') { return (char)(i + charToInt(base, '-')); }
inline void addMod(ll& a, ll b) { a += b; a %= mod; }
inline void subMod(ll& a, ll b) { a -= b; if (a < 0) { a += mod; } }
inline void mulMod(ll& a, ll b) { a *= b; a %= mod; }
inline ll powerMod(ll a, ll n) { ll ans = 1; while (n > 0) { if (n & 1) { mulMod(ans, a); } mulMod(a, a); n >>= 1; } return ans; }
inline ll powerNoMod(ll a, ll n) { ll ans = 1; while (n > 0) { if (n & 1) { ans *= a; } a *= a; n >>= 1; } return ans; }
inline ll gcd(ll a, ll b) { if (b == 0) { return a; } return gcd(b, a % b); }
inline ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
inline bool isEqualDouble(double a, double b, double epsilon = 0.0000001) { return fabs(a - b) < epsilon; }
// call fact(f) in main first
inline void fact(vector<ll>& f) { f[0] = 1LL; for (int i = 1; i <= 1e6; i++) { mulMod(f[i], (ll)i); } }
inline ll nCk(ll k, ll n) { ll ans = 1; k = max(k, n - k); for (int i = 0; i < k; i++) { ans *= (n - i); ans /= (i + 1); } return ans; }
inline ll nCk(const vector<ll>& f, int k, int n) { if (k < 0 || k > n) { return 0; } ll d = (f[k] * f[n - k]) % mod; d = powerMod(d, (ll)mod - 2LL); return (f[n] * d) % mod; }
/* Author: Alvex Nguyen */
const int N = 1e5 + 5;
int freqEven[N];
int freqOdd[N];
bool usedEven[N], usedOdd[N];
int main()
{
    FASTCIN
    int n;
    cin >> n;
    int i, t;
    vector<int> a;
    for (i = 0; i < n; i++)
    {
        cin >> t;
        a.pb(t);
        if (i % 2 == 0)
        {
            freqEven[t]++;
        }
        else
        {
            freqOdd[t]++;
        }
    }
    vector<pair<int, int> > evens, odds;
    for (i = 0; i < n; i++)
    {
        if (i % 2 == 0 && !usedEven[a[i]])
        {
            evens.pb({ freqEven[a[i]], a[i] });
            usedEven[a[i]] = true;
        }
        if (i % 2 != 0 && !usedOdd[a[i]])
        {
            odds.pb({ freqOdd[a[i]], a[i] });
            usedOdd[a[i]] = true;
        }
    }
    int ans = 0;
    sort(range(evens));
    sort(range(odds));
    if (evens.back().nd != odds.back().nd)
    {
        ans = n - evens.back().st - odds.back().st;
    }
    else
    {
        if (evens.size() >= 2 && odds.size() >= 2)
        {
            ans = min(n - evens.back().st - odds[(int)odds.size() - 2].st,
                      n - odds.back().st - evens[(int)evens.size() - 2].st);
        }
        else if (evens.size() >= 2 && odds.size() >= 1)
        {
            ans = n - odds.back().st - evens[(int)evens.size() - 2].st;
        }
        else if (evens.size() >= 1 && odds.size() >= 2)
        {
            ans = n - evens.back().st - odds[(int)odds.size() - 2].st;
        }
        else
        {
            ans = n / 2;
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 2936