import java.io.*;
import java.util.*;

class Main{

    void solve(){
        int n = ni();
        int[] up = new int[100001];
        int[] down = new int[100001];
        for(int i = 0; i < n; i++){
            int v = ni();
            if(i % 2 == 1){
                up[v] += 1;
            } else {
                down[v] += 1;
            }
        }

        int upFirst = 0;
        int upSecond = 0;
        int downFirst = 0;
        int downSecond = 0;
        for(int i = 1; i <= 100000; i++){
            if(up[i] > up[upFirst]){
                upSecond = upFirst;
                upFirst = i;
            } else if(up[i] > up[upSecond]){
                upSecond = i;
            }
            if(down[i] > down[downFirst]){
                downSecond = downFirst;
                downFirst = i;
            } else if(down[i] > down[downSecond]){
                downSecond = i;
            }
        }

        int ans = 0;
        if(upFirst != downFirst){
            ans = n - up[upFirst] - down[downFirst];
        } else {
            ans = n - up[upFirst] - down[downSecond];
            if(n - down[downFirst] - up[upSecond] < ans){
                ans = n - down[downFirst] - up[upSecond];
            }
        }

        out.println(ans);

        out.flush();
    }

    public static void main(String[] args){
        Main m = new Main();
        m.solve();
    }

    Main(){
        this.scan = new FastScanner();
        this.out = new PrintWriter(System.out);
    }

    private FastScanner scan;
    private PrintWriter out;
    private final int MOD = 1_000_000_007;
    private final int INF = 2_147_483_647;
    private final long LINF = 9223372036854775807L;
    private long[] fac;
    private long[] finv;
    private long[] inv;

    // Scanner
    int ni(){ return scan.nextInt();}
    int[] ni(int n){int[] a = new int[n]; for(int i = 0; i < n; i++){a[i] = ni();} return a;}
    int[][] ni(int y, int x){int[][] a = new int[y][x];
        for(int i = 0; i < y; i++){for(int j = 0; j < x; j++){a[i][j] = ni();}} return a;}
    long nl(){return scan.nextLong();}
    long[] nl(int n){long[] a = new long[n]; for(int i = 0; i < n; i++){a[i] = nl();} return a;}
    long[][] nl(int y, int x){long[][] a = new long[y][x];
        for(int i = 0; i < y; i++){for(int j = 0; j < x; j++){a[i][j] = nl();}} return a;}
    String ns(){return scan.next();}
    String[] ns(int n){String[] a = new String[n]; for(int i = 0; i < n; i++){a[i] = ns();} return a;}
    String[][] ns(int y, int x){String[][] a = new String[y][x];
        for(int i = 0; i < y; i++){for(int j = 0; j < x; j++){a[i][j] = ns();}} return a;}

    // Mathematics
    int max(int a, int b){return Math.max(a, b);}
    long max(long a, long b){return Math.max(a, b);}
    double max(double a, double b){return Math.max(a, b);}
    int max(int[] a){int max = a[0]; for(int value:a){max = max(max,value);} return max;}
    long max(long[] a){long max = a[0]; for(long value:a){max = max(max,value);} return max;}
    double max(double[] a){double max = a[0]; for(double value:a){max = max(max,value);} return max;}
    int min(int a, int b){return Math.min(a, b);}
    long min(long a, long b){return Math.min(a, b);}
    double min(double a, double b){return Math.min(a, b);}
    int min(int[] a){int min = a[0]; for(int value:a){min = min(min,value);} return min;}
    long min(long[] a){long min = a[0]; for(long value:a){min = min(min,value);} return min;}
    double min(double[] a){double min = a[0]; for(double value:a){min = min(min,value);} return min;}
    long sum(int[] a){long sum = 0; for(int value:a){sum += value;} return sum;}
    long sum(long[] a){long sum = 0; for(long value:a){sum += value;} return sum;}
    double sum(double[] a){double sum = 0; for(double value:a){sum += value;} return sum;}
    int gcd(int a, int b){return b == 0 ? a : gcd(b, a % b);}
    long gcd(long a, long b){return b == 0 ? a : gcd(b, a % b);}
    int lcm(int a, int b){return a / gcd(a, b) * b;}
    long lcm(long a, long b){return a / gcd(a, b) * b;}
    long fact(int n){ if(n == 0){ return 1; } long a = n; for(long i = n - 1; i >= 2; i--){ a = a % MOD * i; } return a; }
    long fact(long n){ if(n == 0){ return 1; } long a = n; for(long i = n - 1; i >= 2; i--){ a = a % MOD * i; } return a; }
    // nPr(int)
    long npr(int n, int r){
        long a = 1;
        for(int i = n; i > n - r; i--){
            a *= i;
        }
        return a;
    }
    // nPr(long)
    long npr(long n, long r){
        long a = 1;
        for(long i = n; i > n - r; i--){
            a *= i;
        }
        return a;
    }
    // 素数判定(int)
    boolean checkPrime(int n){
        for(int i = 2; i * i <= n; i++){
            if(n % i == 0){
                return false;
            }
        }
        return true;
    }
    // 素数判定(long)
    boolean checkPrime(long n){
        for(long i = 2; i * i <= n; i++){
            if(n % i == 0){
                return false;
            }
        }
        return true;
    }
    // エラトステネスの篩
    long[] erathos(int n){
        boolean[] flag = new boolean[n + 1];
        TreeSet<Integer> nums = new TreeSet<>();
        for(int i = 2; i <= n; i++){
            if(flag[i]) continue;
            nums.add(i);
            for(int j = i * 2; j <= n; j += i){
                flag[j] = true;
            }
        }
        long[] primes = new long[nums.size()];
        int index = 0;
        for(int num : nums){
            primes[index] = num;
            index++;
        }

        return primes;
    }

    // mod pにおける累乗 a^n
    long modpow(long a, long n, long p){
        long res = 1;
        while(n > 0){
            if((n & 1) == 1){
                res = res * a % p;
            }
            a = a * a % p;
            n = n >> 1;
        }
        return res;
    }
    // mod pにおけるaの逆元a^-1
    long modinv(long a, long p){
        return modpow(a, p - 2, p);
    }
    // fac,finv,invの初期化
    void comInit(int max){
        fac = new long[max];
        finv = new long[max];
        inv = new long[max];
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for(int i = 2; i < max; i++){
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }
    // 二項係数nCr
    long com(int n, int r){
        if(n < r || (n < 0 || r < 0)){
            return 0;
        }
        return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
    }
    // 二項係数nCr（nが10^9など巨大なとき用）
    long ncr(long n, long k){
        long a = 1;
        long b = 1;
        for(int i = 1; i <= k; i++){
            a = a * (n + 1 - i) % MOD;
            b = b * i % MOD;
        }

        return modinv(b, MOD) * a % MOD;
    }
    // 二次元上の二点間の距離
    double distance(double x1, double y1, double x2, double y2){
        double dist = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
        return dist;
    }
    // 三次元上の二点間の距離
    double distance(double x1, double y1, double z1, double x2, double y2, double z2){
        double dist = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2));
        return dist;
    }

    // Array
    void sort(int[] a){ Arrays.sort(a);}
    void sort(long[] a){ Arrays.sort(a);}
    void sort(double[] a){ Arrays.sort(a);}
    void sort(String[] a){ Arrays.sort(a);}
    int[] reverse(int[] a){
        int[] reversed = new int[a.length];
        for(int i = 0; i < a.length; i++){
            reversed[a.length - i - 1] = a[i];
        }
        return reversed;
    }
    long[] reverse(long[] a){
        long[] reversed = new long[a.length];
        for(int i = 0; i < a.length; i++){
            reversed[a.length - i - 1] = a[i];
        }
        return reversed;
    }
    double[] reverse(double[] a){
        double[] reversed = new double[a.length];
        for(int i = 0; i < a.length; i++){
            reversed[a.length - i - 1] = a[i];
        }
        return reversed;
    }
    char[] reverse(char[] a){
        char[] reversed = new char[a.length];
        for(int i = 0; i < a.length; i++){
            reversed[a.length - i - 1] = a[i];
        }
        return reversed;
    }
    String[] reverse(String[] a){
        String[] reversed = new String[a.length];
        for(int i = 0; i < a.length; i++){
            reversed[a.length - i - 1] = a[i];
        }
        return reversed;
    }
    boolean[] reverse(boolean[] a){
        boolean[] reversed = new boolean[a.length];
        for(int i = 0; i < a.length; i++){
            reversed[a.length - i - 1] = a[i];
        }
        return reversed;
    }
    void fill(int[] array, int x) { Arrays.fill(array, x); }
    void fill(long[] array, long x) { Arrays.fill(array, x); }
    void fill(double[] array, double x) { Arrays.fill(array, x); }
    void fill(boolean[] array, boolean x) { Arrays.fill(array, x); }
    void fill(int[][] array, int x) { for(int a[] : array) { fill(a, x); } }
    void fill(long[][] array, long x) { for(long a[] : array) { fill(a, x); } }
    void fill(double[][] array, double x) { for(double a[] : array) { fill(a, x); } }
    void fill(boolean[][] array, boolean x) { for(boolean a[] : array) { fill(a, x); } }
    void fill(int[][][] array, int x) { for(int[][] ary : array) { for(int[] a : ary){ fill(a, x); } } }
    void fill(long[][][] array, long x) { for(long[][] ary : array) { for(long[] a : ary){ fill(a, x); } } }

    // Algorithm
    // 深さ優先探索
    /* void dfs(Node[] nodes, int v, boolean[] seen){
        seen[v] = true;

        for(Edge edge : nodes[v].edges){
            if(seen[edge.to]) continue;
            dfs(nodes, edge.to, seen);
        }

    } */
    // 幅優先探索
    long[] bfs(Node[] nodes, int start){
        Queue<Integer> queue = new ArrayDeque<>();
        queue.add(start);
        long[] dist = new long[nodes.length];
        fill(dist, -1);
        dist[start] = 0;

        while(!queue.isEmpty()){
            int now = queue.poll();
            for(Edge edge : nodes[now].edges){
                if(dist[edge.to] != -1) continue;
                dist[edge.to] = dist[now] + 1;
                queue.add(edge.to);
            }
        }

        return dist;
    }

    // ダイクストラ法
    long[] dijkstra(Node[] nodes, int start){
        Queue<Edge> queue = new PriorityQueue<>();
        long[] dist = new long[nodes.length];
        fill(dist, LINF / 2);
        dist[start] = 0;
        queue.add(new Edge(start, start, dist[start]));

        while(!queue.isEmpty()){
            Edge now = queue.poll();
            if(dist[now.to] < now.cost) continue;
            for(Edge edge : nodes[now.to].edges){
                if(dist[edge.to] > dist[edge.from] + edge.cost){
                    dist[edge.to] = dist[edge.from] + edge.cost;
                    queue.add(new Edge(edge.from, edge.to, dist[edge.to]));
                    nodes[edge.to].past = edge.from;
                }
            }
        }

        return dist;
    }

    // ソート済みint型配列でkey以上の値の最小indexを返す
    int lowerBound(int[] a, int key){
        int ng = -1;
        int ok = a.length;
        while(Math.abs(ok - ng) > 1){
            int mid = (ok + ng) / 2;
            if(a[mid] >= key){
                ok = mid;
            } else {
                ng = mid;
            }
        }
        return ok;
    }
    // ソート済みlong型配列でkey以上の値の最小indexを返す
    int lowerBound(long[] a, long key){
        int ng = -1;
        int ok = a.length;
        while(Math.abs(ok - ng) > 1){
            int mid = (ok + ng) / 2;
            if(a[mid] >= key){
                ok = mid;
            } else {
                ng = mid;
            }
        }
        return ok;
    }
    // 文字列sとtの最長共通部分列の長さを返す
    int lcs(String s , String t){
        int[][] dp = new int[s.length() + 1][t.length() + 1];

        for(int i = 0; i < s.length(); i++){
            for(int j = 0; j < t.length(); j++){
                if(s.charAt(i) == t.charAt(j)){
                    dp[i + 1][j + 1] = max(dp[i][j] + 1, dp[i + 1][j + 1]);
                }
                dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i + 1][j]);
                dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j + 1]);
            }
        }

        return dp[s.length()][t.length()];
    }

}

// ノード
class Node{
    int id;             // ノード番号
    int past;           // 直前の頂点
    List<Edge> edges;   // 辺のリスト

    Node(int id, int past){
        this.id = id;
        this.past = past;
        this.edges = new ArrayList<>();
    }
    void addEdge(Edge edge){
        edges.add(edge);
    }

    public boolean equals(Object obj){
        if(obj instanceof Node){
            Node node = (Node)obj;
            return this.id == node.id;
        }
        return false;
    }
    public int hashCode(){
        return id;
    }
    public String toString(){
        return "[id:" + id + " past: " + past + "]";
    }
}

// 辺の情報を持つクラス
class Edge implements Comparable<Edge>{
    int from;       // どの頂点から
    int to;          //  どの頂点へ
    long cost;       // 辺の重み

    Edge(int from, int to, long cost){
        this.from = from;
        this.to = to;
        this.cost = cost;
    }
    public int compareTo(Edge edge){
        return Long.compare(this.cost, edge.cost);
    }

    public String toString(){
        return "[" + from + " to " + to + " cost:" + cost + "]";
    }
}
// 辺の重み比較のComparator
class EdgeComparator implements Comparator<Edge>{
    @Override
    public int compare(Edge e1, Edge e2){
        long cost1 = e1.cost;
        long cost2 = e2.cost;
        if(cost1 < cost2){
            return -1;
        } else if(cost1 > cost2){
            return 1;
        } else {
            return 0;
        }
    }
}
// Union-Find
class UnionFind{
    int[] par;
    int[] size;
    UnionFind(int N){
        par = new int[N];
        size = new int[N];
        for(int i = 0; i < N; i++){
            par[i] = i;
            size[i] = 1;
        }
    }

    void init(int N){
        for(int i = 0; i < N; i++){
            par[i] = i;
            size[i] = 1;
        }
    }

    int root(int x){
        if(par[x] == x){
            return x;
        } else {
            return par[x] = root(par[x]);
        }
    }

    boolean same(int x, int y){
        return root(x) == root(y);
    }

    void unite(int x, int y){
        x = root(x);
        y = root(y);
        if(x == y) return;
        if(size[x] < size[y]){
            int tmp = x;
            x = y;
            y = tmp;
        }
        size[x] += size[y];
        par[y] = x;
    }

    int size(int x){
        return size[root(x)];
    }

}

// 順列を管理する
class Permutation {
    private int number;
    private int listSize;
    private int searched;
    private int nextIndex;
    private int[][] permList;

    Permutation(int num) {
        this.number = num;
        this.listSize  = this.fact(this.number);
        this.searched   = 0;
        this.nextIndex = 0;
        this.permList  = new int[this.listSize][this.number];

        this.create(0, new int[this.number], new boolean[this.number]);
    }

    int[] nextPerm() {
        return permList[this.nextIndex++];
    }

    boolean isNext() {
        if(this.nextIndex < this.listSize) {
            return true;
        } else {
            this.nextIndex = 0;
            return false;
        }
    }

    int fact(int n){
        return n == 0 ? 1 : n * fact(n-1);
    }

    void create(int num, int[] list, boolean[] flag) {
        if(num == this.number) {
            copyArray(list, permList[this.searched]);
            this.searched++;
        }
        for(int i = 0; i < this.number; i++){
            if(flag[i]) continue;
            list[num] = i;
            flag[i] = true;
            this.create(num+1, list, flag);
            flag[i] = false;

        }
    }

    void copyArray(int[] from, int[] to) {
        for(int i=0; i<from.length; i++) to[i] = from[i];
    }

    void printNum(int[] nums) {
        for(int n : nums) System.out.print(n);
        System.out.println();
    }
}

// 一点更新区間取得Segment Tree
/* class SegTree{
    int[] dat;
    int size;

    SegTree(int N){
        this.dat = new int[N * 4];
        this.size = N;
    }

    // [a, b]の最小値を返す
    // l,rにはノードkに対応する区間を与える
    int query(int a, int b, int k, int l, int r){
        if(r < a || b < l) return Integer.MAX_VALUE;
        if(a <= l && r <= b) return dat[k];
        int vl = query(a, b, k << 1, l, (l + r) / 2);
        int vr = query(a, b, (k << 1) + 1, (l + r) / 2 + 1, r);
        return Math.min(vl, vr);
    }

    // インデックスiの値をxに更新
    void update(int i, int x){
        i += this.size - 1;
        dat[i] = x;
        while(i > 0){
            i = i >> 1;     // 1ビットぶん右シフト
            dat[i] = Math.min(dat[i << 1], dat[(i << 1) + 1]);
        }
    }

    public String toString(){
        StringBuilder sb = new StringBuilder("[");
        for(int i = size; i < 2 * size; i++){
            sb.append(dat[i]).append(",");
        }
        sb.delete(sb.length() - 1, sb.length());
        String output = sb.append("]").toString();
        return output;
    }
} */

// Range Sum Queryを実現するBinary Indexed Tree
class BIT{
    int[] tree;

    BIT(int N){
        this.tree = new int[N + 1];
    }

    int sum(int i){
        int sum = 0;
        while(i > 0){
            sum += this.tree[i];
            i -= i & -i;
        }
        return sum;
    }

    void add(int i, int x){
        while(i <= tree.length){
            this.tree[i] += x;
            i += i & -i;
        }
    }

    public String toString(){
        StringBuilder sb = new StringBuilder("[");
        for(int i = 0; i < tree.length; i++){
            sb.append(tree[i] + ",");
        }
        sb.append("]");
        String output = sb.toString();
        return output;
    }

}

// 標準のScannerより高速に標準入力する
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {

		FastScanner sc = new FastScanner();
		int n = sc.nextInt();
		int[] v = new int[n + 1];
		for (int i = 1; i <= n; i++)
			v[i] = sc.nextInt();
		int[] odd = new int[n / 2 + 1];
		int[] even = new int[n / 2 + 1];
		for (int i = 1; i <= n; i++) {
			if (i % 2 == 1)
				odd[(i + 1) / 2] = v[i];
			else if (i % 2 == 0)
				even[i / 2] = v[i];
		}
		int[] a = new int[100001];
		int[] b = new int[100001];
		for (int i = 1; i <= n / 2; i++) {
			a[odd[i]]++;
			b[even[i]]++;
		}
		int amax1 = 0;
		int bmax1 = 0;
		int amax2 = 0;
		int bmax2 = 0;
		int ak1 = 0;
		int bk1 = 0;

		for (int i = 1; i <= 100000; i++) {
			if (amax1 < a[i]) {
				amax1 = a[i];
				ak1 = i;
			}
		}
		for (int i = 1; i <= 100000; i++) {
			if (ak1 != i) {
				if (amax2 < a[i]) {
					amax2 = a[i];

				}
			}
		}
		for (int i = 1; i <= 100000; i++) {
			if (bmax1 < b[i]) {
				bmax1 = b[i];
				bk1 = i;
			}
		}
		for (int i = 1; i <= 100000; i++) {
			if (bk1 != i) {
				if (bmax2 < b[i]) {
					bmax2 = b[i];

				}
			}
		}
		if (ak1 != bk1)
			System.out.println(n - amax1 - bmax1);
		else
			System.out.println(Math.min(n - amax2 - bmax1, n - amax1 - bmax2));

	}
	//以下、自作ライブラリ

	//最大公約数
	public static long gcd(long a, long b) {
		if (a < b)
			return gcd(b, a);
		long c = 0;
		c = a % b;
		if (c == 0)
			return b;
		return gcd(b, c);
	}

	//最小公倍数
	public static long lcm(long m, long n) {
		return m * n / gcd(m, n);
	}

	//素数判定
	public static boolean isPrime(int n) {
		if (n < 2)
			return false;
		if (n == 2)
			return true;
		if (n % 2 == 0)
			return false;

		for (int i = 3; i * i <= n; i += 2) {
			if (n % i == 0)
				return false;
		}
		return true;
	}
}

//以下、高速スキャナークラス
class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

	public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);

			int n = sc.nextInt();
			TreeMap<Integer,Integer> m1 = new TreeMap<Integer,Integer>();
			TreeMap<Integer,Integer> m2 = new TreeMap<Integer,Integer>();
			int sum1 = 0;
			int max11 = 0;
			int key11 = 0;
			int max12 = 0;
			int key12 = 0;

			int sum2 = 0;
			int max21 = 0;
			int key21 = 0;
			int max22 = 0;
			int key22 = 0;

			for(int i=0;i<n/2;i++) {
				m1.merge(sc.nextInt(), 1, Integer::sum);
				m2.merge(sc.nextInt(), 1, Integer::sum);
			}

			for(Map.Entry<Integer, Integer> e : m1.entrySet()) {
				sum1 += e.getValue();
				if(max11<=e.getValue()) {
					max12 = max11;
					max11 = Math.max(max11, e.getValue());
					key12 = key11;
					key11 = e.getKey();
				}

				if(max12<=e.getValue()) {
					max12 = Math.max(max12, e.getValue());
					key12 = e.getKey();
				}

			}

			for(Map.Entry<Integer, Integer> e : m2.entrySet()) {
				sum2 += e.getValue();
				if(max21<=e.getValue()) {
					max22 = max21;
					max21 = Math.max(max21, e.getValue());
					key22 = key21;
					key21 = e.getKey();
				}
				if(max22<=e.getValue()) {
					max22 = Math.max(max22, e.getValue());
					key22 = e.getKey();
				}
			}

			/*
			System.out.println(m1);
			System.out.println(m2);
			System.out.println(key11);
			System.out.println(key12);
			System.out.println(key21);
			System.out.println(key22);
			*/
			if(m1.size()==1&&m1.equals(m2)) {
				System.out.println(n/2);
			}else {
				if(key11!=key21) {
					System.out.println(sum1+sum2-m1.get(key11)-m2.get(key21));
				}else {
					if(m1.get(key11)+m2.get(key22)>m1.get(key12)+m2.get(key21)) {
						System.out.println(sum1+sum2-m1.get(key11)-m2.get(key22));
					}else {
						System.out.println(sum1+sum2-m1.get(key12)-m2.get(key21));
					}
				}
			}

	    }

	}


import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

	public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);

			int n = sc.nextInt();
			TreeMap<Integer,Integer> m1 = new TreeMap<Integer,Integer>();
			TreeMap<Integer,Integer> m2 = new TreeMap<Integer,Integer>();
			int sum1 = 0;
			int max11 = 0;
			int key11 = 0;
			int max12 = 0;
			int key12 = 0;

			int sum2 = 0;
			int max21 = 0;
			int key21 = 0;
			int max22 = 0;
			int key22 = 0;

			for(int i=0;i<n/2;i++) {
				m1.merge(sc.nextInt(), 1, Integer::sum);
				m2.merge(sc.nextInt(), 1, Integer::sum);
			}

			for(Map.Entry<Integer, Integer> e : m1.entrySet()) {
				sum1 += e.getValue();
				if(max11<=e.getValue()) {
					max12 = max11;
					max11 = Math.max(max11, e.getValue());
					key12 = key11;
					key11 = e.getKey();
				}

			}

			for(Map.Entry<Integer, Integer> e : m2.entrySet()) {
				sum2 += e.getValue();
				if(max21<=e.getValue()) {
					max22 = max21;
					max21 = Math.max(max21, e.getValue());
					key22 = key21;
					key21 = e.getKey();
				}
			}

			//System.out.println(m1);
			//System.out.println(m2);

			if(m1.size()==1&&m1.equals(m2)) {
				System.out.println(n/2);
			}else {
				if(key11!=key21) {
					System.out.println(sum1+sum2-m1.get(key11)-m2.get(key21));
				}else {
					if(m1.get(key11)+m2.get(key22)>m1.get(key12)+m2.get(key21)) {
						System.out.println(sum1+sum2-m1.get(key11)-m2.get(key22));
					}else {
						System.out.println(sum1+sum2-m1.get(key12)-m2.get(key21));
					}
				}
			}

	    }

	}


import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

	public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);

			int n = sc.nextInt();
			TreeMap<Integer,Integer> m1 = new TreeMap<Integer,Integer>();
			TreeMap<Integer,Integer> m2 = new TreeMap<Integer,Integer>();
			int sum1 = 0;
			int max11 = 0;
			int key11 = 0;
			int max12 = 0;
			int key12 = 0;

			int sum2 = 0;
			int max21 = 0;
			int key21 = 0;
			int max22 = 0;
			int key22 = 0;

			for(int i=0;i<n/2;i++) {
				m1.merge(sc.nextInt(), 1, Integer::sum);
				m2.merge(sc.nextInt(), 1, Integer::sum);
			}

			for(Map.Entry<Integer, Integer> e : m1.entrySet()) {
				sum1 += e.getValue();
				if(max11<=e.getValue()) {
					max12 = max11;
					max11 = Math.max(max11, e.getValue());
					key12 = key11;
					key11 = e.getKey();
				}

			}

			for(Map.Entry<Integer, Integer> e : m2.entrySet()) {
				sum2 += e.getValue();
				if(max21<=e.getValue()) {
					max22 = max21;
					max21 = Math.max(max21, e.getValue());
					key22 = key21;
					key21 = e.getKey();
				}
			}

			System.out.println(m1);
			System.out.println(m2);

			if(m1.size()==1&&m1.equals(m2)) {
				System.out.println(n/2);
			}else {
				if(key11!=key21) {
					System.out.println(sum1+sum2-m1.get(key11)-m2.get(key21));
				}else {
					if(m1.get(key11)+m2.get(key22)>m1.get(key12)+m2.get(key21)) {
						System.out.println(sum1+sum2-m1.get(key11)-m2.get(key22));
					}else {
						System.out.println(sum1+sum2-m1.get(key12)-m2.get(key21));
					}
				}
			}

	    }

	}


#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class S, class T> inline S chmax(S &a, T b){
  if(a<b){
    a=b;
  }
  return a;
}
int N;
int A[100000];
int cnt1[100000];
int cnt2[100000];
int main(){
  int i, m1, m2, res;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<N;Lj4PdHRW++){
      rd(A[Lj4PdHRW]);A[Lj4PdHRW] += (-1);
    }
  }
  for(i=0;i<N;i+=2){
    cnt1[A[i]]++;
  }
  for(i=1;i<N;i+=2){
    cnt2[A[i]]++;
  }
  {
    int FmcKpFmN, Q5VJL1cS, RZTsC2BF, cTE1_r3A, e98WHCEY=0;
    for(Q5VJL1cS=0;Q5VJL1cS<((100000)-1)+1;Q5VJL1cS++){
      RZTsC2BF = cnt1[Q5VJL1cS];
      if(e98WHCEY==0 || cTE1_r3A<RZTsC2BF){
        cTE1_r3A = RZTsC2BF;
        e98WHCEY = 1;
        FmcKpFmN = Q5VJL1cS;
      }
    }
    m1 =FmcKpFmN;
  }
  {
    int KrdatlYV, WYIGIcGE, ao_dF3pO, tU__gIr_, t_ynMSdg=0;
    for(WYIGIcGE=0;WYIGIcGE<((100000)-1)+1;WYIGIcGE++){
      ao_dF3pO = cnt2[WYIGIcGE];
      if(t_ynMSdg==0 || KrdatlYV<ao_dF3pO){
        KrdatlYV = ao_dF3pO;
        t_ynMSdg = 1;
        tU__gIr_ = WYIGIcGE;
      }
    }
    m2 =tU__gIr_;
  }
  res = 0;
  for(i=0;i<100000;i++){
    if(i!=m1){
      chmax(res, cnt1[m1] + cnt2[i]);
    }
  }
  for(i=0;i<100000;i++){
    if(i!=m2){
      chmax(res, cnt1[i] + cnt2[m2]);
    }
  }
  res = N - res;
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190721-1

// --- original code ---
// int N, A[1d5];
//
// int cnt1[1d5], cnt2[1d5];
// {
//   int i, m1, m2, res;
//   rd(N,(A--)(N));
//
//   for(i=0;i<N;i+=2) cnt1[A[i]]++;
//   for(i=1;i<N;i+=2) cnt2[A[i]]++;
//   m1 = argmax(cnt1(1d5));
//   m2 = argmax(cnt2(1d5));
//
//   res = 0;
//   rep(i,1d5) if(i!=m1) res >?= cnt1[m1] + cnt2[i];
//   rep(i,1d5) if(i!=m2) res >?= cnt1[i] + cnt2[m2];
//   res = N - res;
//
//   wt(res);
// }


#include<cstdio>
#include<cstring>
#include<algorithm>
int Min(int a,int b){return a<b?a:b;}
int Max(int a,int b){return a>b?a:b;}
inline int read()
{
	int 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<<3)+(x<<1)+c-'0';c=getchar();}
	return x*f;
}
int n,v[100005],num[100005],ans,m1,m2,M1,M2,b1,b2,B1,B2;
int main()
{
	n=read();
	for(int i=1;i<=n;i++) v[i]=read();
	for(int i=1;i<=n;i+=2) num[v[i]]++;
	for(int i=1;i<=100000;i++)
	{
		if(num[i]>=m2)
		{
			if(num[i]>=m1)
			{
				m2=m1;b2=b1;
				m1=num[i];b1=i;
			}
			else{m2=num[i];b2=i;}
		}
	}
//	printf("%d\n",m);
	memset(num,0,sizeof num);
	for(int i=2;i<=n;i+=2) num[v[i]]++;
	for(int i=1;i<=100000;i++)
	{
		if(num[i]>=M2)
		{
			if(num[i]>=M1)
			{
				M2=M1;B2=B1;
				M1=num[i];B1=i;
			}
			else{M2=num[i];B2=i;}
		}
	}
	//printf("%d %d %d %d\n",m1,m2,M1,M2);
	if(b1!=B1) printf("%d",n-M1-m1);
	else
	{
		if(M2>0&&m2>0) return 0*printf("%d",n-Max(m1+M2,m2+M1));
		if(M2>0) return 0*printf("%d",n-m1-M2);
		if(m2>0) return 0*printf("%d",n-m2-M1);
		printf("%d",n>>1);
	}
}


#include<set>
#include<map>
#include<ctime>
#include<queue>
#include<cmath>
#include<climits>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LL long long
using namespace std;
int read(){
    int f=1,x=0;char s=getchar();
    while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}
    while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();}
    return x*f;
}
#define MAXN 100000
#define INF 0x3f3f3f3f
int cnt[2][MAXN+5];
int main(){
	int v,n=read();
	for(int i=1;i<=n;i++)
		v=read(),cnt[i%2][v]++;
	int Maxa1=0,Maxa2=0,Maxb1=0,Maxb2=0;
	for(int i=0;i<=MAXN;i++){
		if(cnt[1][Maxa1]<cnt[1][i])
			Maxa2=Maxa1,Maxa1=i;
		else if(cnt[1][Maxa2]<cnt[1][i])
			Maxa2=i;
		if(cnt[0][Maxb1]<cnt[0][i])
			Maxb2=Maxb1,Maxb1=i;
		else if(cnt[0][Maxb2]<cnt[0][i])
			Maxb2=i;
	}
	if(Maxa1!=Maxb1)
		printf("%d\n",n-cnt[1][Maxa1]-cnt[0][Maxb1]);
	else printf("%d\n",n-max(cnt[1][Maxa1]+cnt[0][Maxb2],cnt[1][Maxa2]+cnt[0][Maxb1]));
	return 0;
}


/* BISMILLAHIR RAHMANIR RAHIM */
#include<bits/stdc++.h>
using namespace std;
#define ll        long long
#define ull       unsigned long long
#define sd(x)     scanf("%lf", &x)
#define l0(i,n)   for(ll i=0; i<n; i++)
#define MAX       100005
#define maxn 	  200005
#define pb 		  push_back
#define mk 		  make_pair
#define endl	  "\n"
#define INF 	  1000000000
#define MOD		  1000000007
#define imie(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int main()
{
	int n;
	cin >> n;
	vector <int> a(n);
	for (auto &x : a) cin >> x;
	set<int> s;
	for (auto x : a)
		s.insert(x);
	if(s.size()==1)
	{
		cout << n/2 << endl;
		return 0;
	}
	else
	{
		cout << s.size() - 2 << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const long long INF = 1LL << 60;
const ll C = 1000000000+7;

int main() {
    int N;
    cin >> N;
    vector<int> odd(100005), even(100005);
    for(int i=1; i<=N; i++) {
        int v;
        cin >> v;
        if(i%2 == 0) {
            odd[v]++;
        }
        else {
            even[v]++;
        }
    }

    vector<int>::iterator iter = max_element(odd.begin(), odd.end());
    int oindex = distance(odd.begin(), iter);
    vector<int>::iterator e_iter = max_element(even.begin(), even.end());
    int eindex = distance(even.begin(), e_iter);

    sort(odd.begin(), odd.end());
    reverse(odd.begin(), odd.end());
    sort(even.begin(), even.end());
    reverse(even.begin(), even.end());

    if(oindex == eindex) {
        cout << (N/2) - odd[1] + (N/2) - even[0] << endl;
        return 0;
    }
    cout << (N/2) - odd[0] + (N/2) - even[0];
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define all(x) x.begin(), x.end()
using ll = long long;
using pii = pair<int, int>;
const int mod = 1e9+7;

template<class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    rep(i, n) {
        cin >> v[i];
    }
    map<int, int> m1, m2;
    int a1 = 0, a2 = 0;
    int x1, x2;
    for (int i = 0; i < n; i += 2) {
        m1[v[i]]++;
        if (chmax(a1, m1[v[i]])) x1 = v[i];
    }
    for (int i = 1; i < n; i += 2) {
        m2[v[i]]++;
        if (chmax(a2, m2[v[i]])) x2 = v[i];
    }
    int ans;
    if (x1 != x2) {
        ans = n - a1 - a2;
    } else  {
        ans = n - a2;
    }
    cout << ans << endl;
}


#include<stdio.h>

int odd[100001];
int even[100001];
int n, odd1, odd2, even1, even2, i;
char c;

int max(int a, int b);
int nextInt();

int main(){
	n = nextInt();
	for(i=0; i<n; i+=2){
		odd[nextInt()]++;
		even[nextInt()]++;
	}
	for(i=0; i<100001; i++){
		if(odd[i] > odd[odd1]){
			odd2 = odd1;
			odd1 = i;
		}else if(odd[i] > odd[odd2]){
			odd2 = i;
		}
		if(even[i] > even[even1]){
			even2 = even1;
			even1 = i;
		}else if(even[i] > even[even2]){
			even2 = i;
		}
	}
	if(odd1 == even1){
		i = max(odd[odd1]+even[even2], odd[odd2]+even[even1]);
	}else{
		i = odd[odd1]+even[even1];
	}
	printf("%d", n-i);
	return 0;
}

int max(int a, int b){
	return (a<b?b:a);
}

int nextInt(){
	int f=0;
	c= getchar();
	while((c<'0')||('9'<c)){
		c=getchar();
	}
	while((c>='0')&&(c<='9')){
		f=f*10+(c-'0');
		c=getchar();
	}
	return f;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
  int n,v[100005],w[100005],elem1[100005]={},elem2[100005]={},i,k=0,l=0,max1,max2,a,b;
  int maxvalue1,maxvalue2,num1=0,num2=0,next,nextvalue,next1,nextvalue1,answer,minanswer;
  char str[1000000],*p;

  fgets(str,sizeof(str),stdin);
  n=atoi(str);

  fgets(str,sizeof(str),stdin);
  p=strtok(str," \n");
  v[l]=atoi(p),l++,num1=v[0];
  for(i=1;i<n;i++){
    p=strtok(NULL," \n");
    if(i%2==1){
      w[k]=atoi(p);
      if(num2<w[k]){
        num2=w[k];
      }
      k++;
    }else{
      v[l]=atoi(p);
      if(num1<v[l]){
        num1=v[l];
      }
      l++;
    }
  }

  for(i=0;i<n/2;i++){
    elem1[v[i]]++;
  }
  for(i=0,max1=0,maxvalue1=0,next1=0,nextvalue1=0;i<=num1;i++){
    if(max1<=elem1[i]){
      next1=max1,nextvalue1=maxvalue1,max1=elem1[i],maxvalue1=i;
    }else if(next1<elem1[i]){
      next1=elem1[i],nextvalue1=i;
    }
  }
  for(i=0;i<n/2;i++){
    elem2[w[i]]++;
  }
  for(i=0,max2=0,maxvalue2=0,next=0,nextvalue=0;i<=num2;i++){
    if(max2<elem2[i]){
      next=max2,nextvalue=maxvalue2,max2=elem2[i],maxvalue2=i;
    }else if(max2<=elem2[i] && i!=maxvalue1){
      next=max2,nextvalue=maxvalue2,max2=elem2[i],maxvalue2=i;
    }else if(next<elem2[i]){
      next=elem2[i],nextvalue=i;
    }

  }

  if(maxvalue1!=maxvalue2){
    answer=n-max1-max2;
    minanswer=answer;
    printf("%d\n",minanswer);
    return 0;
  }
  if(maxvalue1==maxvalue2){
    a=n-max1-next;
    b=n-next1-max2;
    if(a<b){
      minanswer=a;
    }else{
      minanswer=b;
    }
  }

  printf("%d\n",minanswer);

  return 0;
}


//q1
// pactice

#pragma warning(disable:4996)
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wwrite-strings"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#define MAX_NUMBER 100000
#define MAX_STRING 700000

	int aOdd[MAX_NUMBER/2];
	int aEven[MAX_NUMBER/2];
	int aOddPattern[MAX_NUMBER];
	int aEvenPattern[MAX_NUMBER];
	char sInput[MAX_STRING+1]="";

int main() {

	char* psInput=NULL;
	int nNumberOfNumber=0;

	int i=0;
	int iTemp=0;
	int iOddTopNumber=0;
	int iOddTopCount=0;
	int iOddTopNumber_Temp=0;
	int iOddTopCount_Temp=0;
	int iOdd2ndNumber=0;
	int iOdd2ndCount=0;

	int iEvenTopNumber=0;
	int iEvenTopCount=0;
	int iEvenTopNumber_Temp=0;
	int iEvenTopCount_Temp=0;
	int iEven2ndNumber=0;
	int iEven2ndCount=0;

	int iHaveSameNumber=0;

	int iTest1=0;
	int iTest2=0;

	for(i=0;i;i++){
		aOdd[i]=0;
		aEven[i]=0;
		aOddPattern[i]=0;
		aEvenPattern[i]=0;
	}
	// read line 1
	gets(sInput);
	nNumberOfNumber=atoi(sInput);

	// read line 2
	gets(sInput);
	psInput = strtok(sInput," ");
	for (i=0;i<nNumberOfNumber;i++){
		iTemp=atoi(psInput);
		if(i%2){
			//Odd
			aOdd[i/2]=iTemp;

			aOddPattern[iTemp-1]=aOddPattern[iTemp-1]+1;

			if(aOddPattern[iTemp-1]>iOddTopCount){
				iOddTopNumber=iTemp;
				iOddTopCount=aOddPattern[iTemp-1];
			}

		} else {
			// Even
			aEven[i/2]=iTemp;

			aEvenPattern[iTemp-1]=aEvenPattern[iTemp-1]+1;
			if(aEvenPattern[iTemp-1]>iEvenTopCount){
				iEvenTopNumber=iTemp;
				iEvenTopCount=aEvenPattern[iTemp-1];
			}
		}
		psInput = strtok(NULL," ");
	}
	if(iOddTopNumber==iEvenTopNumber){
		iHaveSameNumber=1;
		for(i=0;i<nNumberOfNumber;i++){
			if(iOddTopNumber!=i+1 && iOddTopCount == aOddPattern[i]){
				iOddTopNumber=i+1;
				iHaveSameNumber=0;
			}
		}
		if(iHaveSameNumber){
			for(i=0;i<nNumberOfNumber;i++){
				if(iEvenTopNumber!=i+1 && iEvenTopCount == aEvenPattern[i]){
					iEvenTopNumber=i+1;
					iHaveSameNumber=0;
				}
			}
		}
	}

	if(!iHaveSameNumber){
		printf("%d\n",(nNumberOfNumber-iOddTopCount-iEvenTopCount));
	} else {

			for(i=0;i<nNumberOfNumber;i++){
				if(iOddTopNumber!=i+1 && iOdd2ndCount < aOddPattern[i]){
					iOdd2ndNumber=i+1;
					iOdd2ndCount=aOddPattern[i];
				}
				if(iEvenTopNumber!=i+1 && iEven2ndCount < aEvenPattern[i]){
					iEven2ndNumber=i+1;
					iEven2ndCount=aEvenPattern[i];
				}
			}

			iTest1=iOddTopCount+iEven2ndCount;
			iTest2=iEvenTopCount+iOdd2ndCount;

			if(!iOdd2ndNumber){
				iTest1=nNumberOfNumber-iOddTopCount-iEven2ndCount;
				iTest2=nNumberOfNumber-iEvenTopCount;
			} else if (!iEven2ndNumber){
				iTest1=nNumberOfNumber-iOddTopCount;
				iTest2=nNumberOfNumber-iEvenTopCount-iOdd2ndCount;
			} else {
				iTest1=nNumberOfNumber-iOddTopCount-iEven2ndCount;
				iTest2=nNumberOfNumber-iEvenTopCount-iOdd2ndCount;
			}

			if(iTest1<iTest2){
				printf("%d\n",iTest1);
			} else {
				printf("%d\n",iTest2);
			}
	}
/*
		if(iOddTopCount>iEvenTopCount){
			iEvenTopNumber_Temp=iEvenTopNumber;
			iEvenTopNumber=0;
			iEvenTopCount_Temp=iEvenTopCount;
			iEvenTopCount=0;
			for(i=0;i<nNumberOfNumber;i++){
				if(iOddTopNumber!=i+1 && iEvenTopCount < aEvenPattern[i]){
					iEvenTopNumber=i+1;
					iEvenTopCount=aEvenPattern[i];
				}
			}
			if(!iEvenTopNumber){
				iEvenTopNumber=iEvenTopNumber_Temp;
				iEvenTopCount=iEvenTopCount_Temp;
				printf("%d\n",(nNumberOfNumber-iOddTopCount));
			}else {
				printf("%d\n",(nNumberOfNumber-iOddTopCount-iEvenTopCount));
			}
		} else {
			iOddTopNumber_Temp=iOddTopNumber;
			iOddTopNumber=0;
			iOddTopCount_Temp=iOddTopCount;
			iOddTopCount=0;
			for(i=0;i<nNumberOfNumber;i++){
				if(iEvenTopNumber!=i+1 && iOddTopCount < aOddPattern[i]){
					iOddTopNumber=i+1;
					iOddTopCount=aOddPattern[i];
				}
			}
			if(!iOddTopNumber){
				iOddTopNumber=iOddTopNumber_Temp;
				iOddTopCount=iOddTopCount_Temp;
				printf("%d\n",(nNumberOfNumber-iEvenTopCount));
			}else {
				printf("%d\n",(nNumberOfNumber-iOddTopCount-iEvenTopCount));
			}
		}
	}
*/

	return 0;
}


#include<stdio.h>
int main(){
  int a[10001];
  int n,cnt=0;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(int i=0;i<n-2;i++){
    if(a[i] != a[i+2]){
      cnt++;
    }
  }
  if(cnt == n-2){
    printf("%d",n/2);
  }else if(cnt == 0){
    printf("%d",0);
  }else{
    printf("%d",cnt);
  }
  return 0;
}


#include<stdio.h>
int main(){
  int a[10001];
  int n,cnt=0;
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(int i=0;i<n-2;i++){
    if(a[i] != a[i+2]){
      cnt++;
    }
  }
  if(cnt == n-2){
    printf("%d",n/2);
  }else if(cnt == 0){
    printf("%d",0);
  }else{
    printf("%d",cnt);
  }
  return 0;
}


#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
typedef long long ll;

// cant imp

int main() {
    cin.tie(0);
    cin.sync_with_stdio(0);

    int n, v;
    cin >> n;
    vector<int> ecnt(100001, 0), ocnt(100001, 0);
    for (int i = 0; i < n; i++) {
        scanf("%d", &v);
        if (i % 2 == 0) ecnt[v]++;
        else ocnt[v]++;
    }

    int max_ecnt = 0, max_ocnt = 0;
    int max_e = 0, max_o = 0;
    for (int i = 0; i < 100001; i++) {
        if (max_ecnt < ecnt[i]) {
            max_ecnt = ecnt[i];
            max_e = i;
        }
        if (max_ocnt < ocnt[i]) {
            max_ocnt = ocnt[i];
            max_o = i;
        }
    }

    int ans;
    if (max_o == max_e) {
        sort(ecnt.begin(), ecnt.end(), greater<int>());
        sort(ocnt.begin(), ocnt.end(), greater<int>());
        int t1 = n - max_ecnt - ocnt[1];
        int t2 = n - ecnt[1] - max_ocnt;
        ans = min(t1, t2);
    } else {
        ans = n - max_ocnt - max_ecnt;
    }

    cout << ans << endl;
}


function twoMax(arr) {
    var first = 0;
    var firstKey = -1
    var second = 0;
    var secondKey = -1;
    for (var i = 0; i < arr.length; i++) {
        if (arr[i] >= first) {
            second = first;
            secondKey = firstKey;
            first = arr[i];
            firstKey = i;
        } else if (arr[i] >= second) {
            second = arr[i];
            secondKey = i;
        }
    }
    return [first, firstKey, second, secondKey];
}
function Main(input) {
    input = input.split("\n");
    var n = parseInt(input[0], 10);
    var V = input[1].split(" ").map(x => parseInt(x, 10));
    var freqEven = new Array(100001).fill(0);
    var freqOdd = new Array(100001).fill(0);
    for (var i = 0; i < n; i++) {
        if (i % 2 == 0) {
            freqEven[V[i]]++;
        } else {
            freqOdd[V[i]]++;
        }
    }
    var evenTwoMax = twoMax(freqEven);
    var evenFirst = evenTwoMax[0];
    var evenFirstKey = evenTwoMax[1];
    var evenSecond = evenTwoMax[2];
    var oddTwoMax = twoMax(freqOdd);
    var oddFirst = oddTwoMax[0];
    var oddFirstKey = oddTwoMax[1];
    var oddSecond = oddTwoMax[2];
    var minus = 0;
    if (evenFirstKey == oddFirstKey) {
        minus = Math.max(evenFirst+oddSecond, oddFirst + evenSecond);
    } else {
        minus = evenFirst + oddFirst;
    }
    console.log(n-minus);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function Main(input) {
  input = input.split("\n");
  n = parseInt(input[0]);
  tmp=input[1].split(" ");
  v=new Array(n);
  var countse = {};
  var countso = {};
  var maxe1 =0;
  var maxe2 =0;
  var maxenum=0;
  var maxo1 =0;
  var maxo2 =0;
  var maxonum=1;
  var ans =0;
  for(i=0;i<n;i++){
    v[i]=parseInt(tmp[i]);
    if(i%2==0){
      var num = v[i];
      countse[num]=countse[num] ? countse[num] +1 :1;
      if(maxe1!=0&&v[maxenum]!=v[i]&&countse[num]>maxe2){
        maxe2=countse[num];
      }
      if(countse[num]>maxe1){
        if(v[maxenum]!=v[i]){
          maxe2=maxe1;
        }
        maxe1=countse[num];
        maxenum=i;
      }
    }else{
      var num = v[i];
      countso[num]=countso[num] ? countso[num] +1: 1;
      if(maxo1!=0&&v[maxonum]!=v[i]&&countso[num]>maxo2){
        maxo2=countso[num];
      }
      if(countso[num]>maxo1){
        if(v[maxonum]!=v[i]){
          maxo2=maxo1;
        }
        maxo1=countso[num];
        maxonum=i
      }
    }
  }

  if(v[maxenum]!=v[maxonum]){
    ans=n-maxe1-maxo1;
  }else{
    ans=Math.min(n-maxe1-maxo2,n-maxe2-maxo1);
  }

  console.log('%s', ans);
}

// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(){
  var input = document.getElementById("input").value;
  Main(input);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


(function(input) {
  'use strict';
  const INPUT = input.split("\n")
  for(let i = 0; i<INPUT.length; i=i+2){
    if(!INPUT[i] || !INPUT[i+1]) continue
    if (INPUT[i] === 2) {
      console.log('0')
      continue
    }
    const length = INPUT[i]
    const line = INPUT[i+1].split(" ")
    let Max = 0
    let MaxNumFirst = ''
    let SecmaxNumFirst = ''
    let countHashFirst = {}
    for(let j=0; j< length; j=j+2){
      countHashFirst[line[j]]
      ? countHashFirst[line[j]]++
      : countHashFirst[line[j]]=1
      if(countHashFirst[line[j]] >= Max){
        Max = countHashFirst[line[j]]
        if (MaxNumFirst != line[j]) SecmaxNumFirst = MaxNumFirst
        MaxNumFirst = line[j]
      }
    }

    Max = 0
    let MaxNumSecond = ''
    let SecmaxNumSecond = ''
    let countHashSecond = {}
    for(let j=1; j< length; j=j+2){
      countHashSecond[line[j]]
      ? countHashSecond[line[j]]++
      : countHashSecond[line[j]]=1
      if(countHashSecond[line[j]] >= Max){
        Max = countHashSecond[line[j]]
        if (MaxNumSecond != line[j])SecmaxNumSecond = MaxNumSecond
        MaxNumSecond = line[j]
      }
    }

    if(MaxNumFirst==MaxNumSecond) {
      let resA = 0
      let resB = 0
      for(let j=0; j< length; j=j+2){
        if(SecmaxNumFirst != line[j]) resA++
        if(MaxNumSecond != line[j+1]) resA++
      }
      for(let j=0; j< length; j=j+2){
        if(SecmaxNumSecond != line[j+1]) resB++
        if(MaxNumFirst != line[j] ) resB++
      }
      console.log(resA > resB ? resB : resA)
    } else {
      let res = 0
      for(let j=0; j< length; j=j+2){
        if(MaxNumFirst != line[j]) res++
        if(MaxNumSecond != line[j+1]) res++
      }
      console.log(res)
    }
  }
})(require('fs').readFileSync('/dev/stdin', 'utf8'))


inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')

N = inp.shift() * 1
inp = inp.shift().split(' ')
a = []
b = []
ao = {}
bo = {}
for (i=0; i<N; i++) {
    if (i % 2) {
        bo[inp[i]] = (bo[inp[i]] || 0) + 1
    } else {
        ao[inp[i]] = (bo[inp[i]] || 0) + 1
    }
}
as = 0
bs = 0
for (k in ao) {
    a.push({k: k, n: ao[k]})
    as += ao[k]
}
for (k in bo) {
    b.push({k: k, n: bo[k]})
    bs += bo[k]
}
a.sort((a, b) => b.n - a.n)
b.sort((a, b) => b.n - a.n)

min = Infinity
if (a[0].k == b[0].k) {
    if (a[1] && b[1]) {
        if (a[0].n < b[0].n) {
            bs -= b[0].n
            as -= a[1].n
        } else {
            bs -= b[1].n
            as -= a[0].n
        }
    } else {
        if (!a[1] && b[1]) {
            bs -= b[1].n
            as -= a[0].n
        } else if (a[1] && !b[1]) {
            bs -= b[0].n
            as -= a[1].n
        } else {
            if (a[0].n < b[0].n) {
                bs = 0
            } else {
                as = 0
            }
        }
    }
} else {
    as -= a[0].n
    bs -= b[0].n
}

console.log(as + bs)


'use strict';
const main = input => {
  const n = parseInt(input[0]), v = input[1].split(' ').map(val => parseInt(val));
  let even = [], odd = [];
  for(let i=0; i<n; i++) {
    if(i%2) odd.push(v[i]);
    else even.push(v[i]);
  }

  let oddmode = (new Array(100000)).fill(0);
  odd.map(val => oddmode[val]++);
  let OmaxId = oddmode.indexOf(Math.max.apply(null, oddmode));
  let Omax = oddmode[OmaxId];
  oddmode[OmaxId] = 0;
  let Osec = Math.max.apply(null, oddmode);

  let evenmode = (new Array(100000)).fill(0);
  even.map(val => evenmode[val]++);
  let EmaxId = evenmode.indexOf(Math.max.apply(null, evenmode));
  let Emax = evenmode[EmaxId];
  evenmode[EmaxId] = 0;
  let Esec = Math.max.apply(null, evenmode);

  if (EmaxId != OmaxId) {
    console.log(n-Emax-Omax);
    return;
  }
  if (Esec==0&&Osec==0) {
    console.log(n/2);
    return;
  }
  if (Esec==0) {
    console.log(n-Emax-Osec);

    return;
  }
  if (Osec==0) {
    console.log(n-Esec-Omax);

    return;
  }
  console.log(Math.min(n-Emax-Osec, n-Esec-Omax));

}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));


'use strict';
const main = input => {
  const n = parseInt(input[0]), v = input[1].split(' ').map(val => parseInt(val));
  // console.log(n, v);
  let even = [], odd = [];
  for(let i=0; i<n; i++) {
    if(i%2) odd.push(v[i]);
    else even.push(v[i]);
  }
  // console.log(even, odd);

  let oddmode = (new Array(100000)).fill(0);
  odd.map(val => oddmode[val]++);
  let Omax = Math.max.apply(null, oddmode);
  let OmaxId = oddmode.indexOf(Math.max.apply(null, oddmode));
  oddmode[OmaxId] = 0;
  let Osec = Math.max.apply(null, oddmode);
  let OsecId = oddmode.indexOf(Math.max.apply(null, oddmode));

  let evenmode = (new Array(100000)).fill(0);
  even.map(val => evenmode[val]++);
  let Emax = Math.max.apply(null, evenmode);
  let EmaxId = evenmode.indexOf(Math.max.apply(null, evenmode));
  evenmode[EmaxId] = 0;
  let Esec = Math.max.apply(null, evenmode);
  let EsecId = evenmode.indexOf(Math.max.apply(null, evenmode));

  if (EmaxId != OmaxId) {
    console.log(n-Emax-Omax);
    return;
  }
  if (Esec==0&&Osec==0) {
    console.log(n/2);
    return;
  }
  if (Esec==0) {
    console.log(n-Emax-Osec);
    return;
  }
  if (Osec==0) {
    console.log(n-Esec-Omax);
    return;
  }
  console.log(Math.min(n-Emax-Osec, n-Esec-Omax));

  // console.log(even, odd);
  // console.log(Emax, Esec, Omax, Osec);

  // if (OmaxId == EmaxId) {
  //   if (odd.length-Omax == even.length-Emax) {
  //     if (odd.length-Osec > even.length-Esec) {
  //       console.log(n-Esec-Omax);
  //     } else {
  //       console.log(n-Osec-Emax);
  //     }
  //   } else if (odd.length-Omax > even.length-Emax) {
  //     console.log(n-Omax-Esec);
  //   } else {
  //     console.log(n-Emax-Osec);

  //   }
  // } else {
  //   console.log(n-Omax-Emax);
  // }
  // // console.log(even.length, odd.length);

}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));


package main

import (
	"fmt"
	"strconv"
	"os"
	"bufio"
	"strings"
)

// template start
var sc = bufio.NewScanner(os.Stdin)

func input2int() int{
	sc.Scan()
	num , _ := strconv.Atoi(sc.Text())
	return num
}

func input2intarr(n int) []int{
	sc.Scan()
	in := strings.Split(sc.Text(), " ")
	out := make([]int, n)
	for i:=0; i<n; i++{
		out[i], _ = strconv.Atoi(in[i])
	}
	return out
}
// template end

func main(){
	var buf = make([]byte, 10000)
	sc.Buffer(buf, 1000000)
	var n = input2int()
	var arr = input2intarr(n)
	var even = make(map[int]int, n/2)
	var odd = make(map[int]int, n/2)
	for i:=0; i<n; i++{
		if i%2 == 0{
			even[arr[i]]++
		} else {
			odd[arr[i]]++
		}
	}
	var e_max, o_max int
	var e_k, o_k int
	for k, v := range(even){
		if v > e_max{
			e_k, e_max = k, v
		}
	}
	for k, v := range(odd){
		if v > o_max{
			o_k, o_max = k, v
		}
	}
	if e_k == o_k{
		if e_max == o_max{
			var first, second int
			first = e_max
			o_max = 0
			odd[o_k] = 0
			for _, v := range(odd){
				if v > o_max{
					o_max =  v
				}
			}
			e_max = 0
			even[e_k] = 0
			for _, v := range(even){
				if v > e_max{
					e_max =  v
				}
			}
			if e_max >= o_max{
				second = e_max
			}else if o_max > e_max{
				second = o_max
			}
			e_max, o_max = first, second
		} else if e_max > o_max{
			o_max = 0
			odd[o_k] = 0
			for _, v := range(odd){
				if v > o_max{
					o_max =  v
				}
			}
		} else {
			e_max = 0
			even[e_k] = 0
			for _, v := range(even){
				if v > e_max{
					e_max =  v
				}
			}
		}
	}
	fmt.Println(n - (e_max + o_max))
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	iv, _ := strconv.Atoi(sc.Text())
	return iv
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	var n int
	fmt.Scan(&n)

	om := make(map[int]int, n/2)
	em := make(map[int]int, n/2)
	for i := 0; i < n/2; i++ {
		xo := scanInt()
		om[xo]++
		xe := scanInt()
		em[xe]++
	}

	type entry struct{ k, v int }
	ol := make([]entry, len(om))
	index := 0
	for k, v := range om {
		ol[index].k, ol[index].v = k, v
		index++
	}
	sort.Slice(ol, func(i, j int) bool { return ol[i].v > ol[j].v })

	el := make([]entry, len(em))
	index = 0
	for k, v := range em {
		el[index].k, el[index].v = k, v
		index++
	}
	sort.Slice(el, func(i, j int) bool { return el[i].v > el[j].v })

	if ol[0].k != el[0].k {
		fmt.Println(n - ol[0].v - el[0].v)
		return
	}

	if len(ol) == 1 {
		ol = append(ol, entry{-1, 0})
	}
	if len(el) == 1 {
		el = append(el, entry{-1, 0})
	}
	if v1, v2 := n-ol[0].v-el[1].v, n-ol[1].v-el[0].v; v1 < v2 {
		fmt.Println(v1)
	} else {
		fmt.Println(v2)
	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var sc = bufio.NewScanner(os.Stdin)

const inf = 1 << 60
const mod int = 1e9 + 7

func ri() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}

type pair struct {
	key int
	val int
}
type pairlist []pair

func (p pairlist) Len() int           { return len(p) }
func (p pairlist) Less(i, j int) bool { return p[i].val > p[j].val }
func (p pairlist) Swap(i, j int)      { p[i], p[j] = p[j], p[i] }
func sortMapByValue(m map[int]int) pairlist {
	pl := make(pairlist, len(m))
	i := 0
	for k, v := range m {
		pl[i] = pair{k, v}
		i++
	}
	sort.Sort(pl)
	return pl
}

func f(a []int) (pair, pair) {
	if len(a) == 0 {
		panic("hoge")
	}

	m := make(map[int]int)
	for _, aa := range a {
		m[aa]++
	}
	sorted := sortMapByValue(m)

	var x, y pair
	if len(sorted) == 1 {
		x, y = sorted[0], pair{-1, 0}
	} else {
		x, y = sorted[0], sorted[1]
	}
	return x, y
}

func smaller(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	sc.Split(bufio.ScanWords)
	n := ri()
	vo := make([]int, 0, n/2)
	ve := make([]int, 0, n/2)
	for i := 0; i < n; i++ {
		if i%2 == 0 {
			vo = append(vo, ri())
		} else {
			ve = append(ve, ri())
		}
	}
	odd_1, odd_2 := f(vo)
	evn_1, evn_2 := f(ve)
	cost := -1
	if odd_1.key != evn_1.key {
		cost = len(vo) - odd_1.val + len(ve) - evn_1.val
	} else {
		tmp1 := len(vo) - odd_1.val + len(ve) - evn_2.val
		tmp2 := len(vo) - odd_2.val + len(ve) - evn_1.val
		cost = smaller(tmp1, tmp2)
	}
	fmt.Println(cost)
}


//go:generate echo "https://atcoder.jp/contests/abc111/tasks/arc103_a"
package main

import (
	"bufio"
	"fmt"
	"io"
	"math/big"
	"os"
	"strconv"
)

var scan = newScanner(os.Stdin)

func solve(vs []int) int {
	mo, me := map[int]int{}, map[int]int{}
	for i, v := range vs {
		if i%2 == 0 { // odd
			mo[v]++
		} else { // even
			me[v]++
		}
	}
	ov1, oc1, oc2 := 0, 0, 0
	for v, c := range mo {
		if oc1 < c {
			oc2 = oc1
			oc1 = c
			ov1 = v
		}
	}
	if len(mo) == 1 {
		oc2 = 0
	}
	ev1, ec1, ec2 := 0, 0, 0
	for v, c := range me {
		if ec1 < c {
			ec2 = ec1
			ec1 = c
			ev1 = v
		}
	}
	if len(me) == 1 {
		ec2 = 0
	}
	if ov1 != ev1 {
		return len(vs) - oc1 - ec1
	}
	return len(vs) - imax(oc1+ec2, ec1+oc2)
}

func main() {
	n := scan.Int()
	vs := scan.Ints(n)
	fmt.Println(solve(vs))
}

// scanner
type scanner struct {
	*bufio.Scanner
}

func newScanner(r io.Reader) *scanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	s.Buffer(nil, 100000000)
	return &scanner{s}
}

func (s *scanner) String() string { s.Scan(); return s.Text() }

func (s *scanner) Strings(l int) []string {
	if l == 0 {
		return []string{}
	}
	sl := make([]string, l, l)
	for i := range sl {
		sl[i] = s.String()
	}
	return sl
}

func (s *scanner) Int() int { n, _ := strconv.Atoi(s.String()); return n }

func (s *scanner) Ints(l int) []int {
	if l == 0 {
		return []int{}
	}
	sl := make([]int, l, l)
	for i := range sl {
		sl[i] = s.Int()
	}
	return sl
}

func (s *scanner) Float64() float64 { f, _ := strconv.ParseFloat(s.String(), 64); return f }

func (s *scanner) Float64s(l int) []float64 {
	if l == 0 {
		return []float64{}
	}
	sl := make([]float64, l, l)
	for i := range sl {
		sl[i] = s.Float64()
	}
	return sl
}

func (s *scanner) BigInt() *big.Int {
	n, _ := strconv.ParseInt(s.String(), 10, 64)
	return big.NewInt(n)
}

func (s *scanner) BigInts(l int) []*big.Int {
	if l == 0 {
		return []*big.Int{}
	}
	sl := make([]*big.Int, l, l)
	for i := range sl {
		sl[i] = s.BigInt()
	}
	return sl
}

func iabs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func imax(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func imin(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func ipow(x, n int) int {
	if n == 0 {
		return 1
	}
	a := ipow(x, n>>1)
	a *= a
	if n&1 != 0 {
		a *= x
	}
	return a
}

func ifact(x int) int {
	f := 1
	for i := 2; i <= x; i++ {
		f *= i
	}
	return f
}

func isum(X []int) int {
	s := 0
	for _, x := range X {
		s += x
	}
	return s
}

func chmax(x *int, v int) { *x = imax(*x, v) }

func chmin(x *int, v int) { *x = imin(*x, v) }

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int { return a * b / gcd(a, b) }

func factor(n int) map[int]int {
	m := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			n /= i
			m[i]++
		}
	}
	if n != 1 {
		m[n]++
	}
	return m
}

func perm(X []int) [][]int {
	makeCopy := func(X []int) []int { return append(make([]int, 0, len(X)), X...) }
	n := len(X)
	c := makeCopy(X)
	res := append(make([][]int, 0, ifact(n)), makeCopy(c))
	p := make([]int, n+1, n+1)
	for i := 0; i < n+1; i++ {
		p[i] = i
	}
	for i := 1; i < n; {
		p[i]--
		j := 0
		if i%2 == 1 {
			j = p[i]
		}
		c[i], c[j] = c[j], c[i]
		res = append(res, makeCopy(c))
		for i = 1; p[i] == 0; i++ {
			p[i] = i
		}
	}
	return res
}

func ndigit(x int) int {
	d := 0
	for ; x > 0; x /= 10 {
		d++
	}
	return d
}

// iheap
type iheap []int

func (h iheap) Len() int { return len(h) }

func (h iheap) Less(i, j int) bool { return h[i] < h[j] }

func (h iheap) Swap(i, j int) { h[i], h[j] = h[j], h[i] }

func (h *iheap) Push(x interface{}) { *h = append(*h, x.(int)) }

func (h *iheap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

// mint
type mint int

var mod = 1000000007

func setMintMod(x int) { mod = x }

func newMint(v int) mint { return mint((v%mod + mod) % mod) }

func (x mint) Add(y mint) mint {
	v := x + y
	if v >= mint(mod) {
		return v - mint(mod)
	}
	return v
}

func (x mint) Sub(y mint) mint {
	v := x + mint(mod) - y
	if v >= mint(mod) {
		return v - mint(mod)
	}
	return v
}

func (x mint) Mul(y mint) mint { return (x * y) % mint(mod) }

func (x mint) Pow(p int) mint {
	if p == 0 {
		return mint(1)
	}
	a := x.Pow(p >> 1)
	a = a.Mul(a)
	if p&1 != 0 {
		a = a.Mul(x)
	}
	return a
}

func (x mint) Inverse() mint { return x.Pow(mod - 2) }

func (x mint) Div(y mint) mint { return x.Mul(y.Inverse()) }

func (x mint) Neg() mint { return newMint(int(-x)) }

// factorial
type factorial struct {
	fact        []mint
	factInverse []mint
}

func newFactorial(n int) *factorial {
	f := new(factorial)
	f.init(n)
	return f
}

func (f *factorial) init(n int) {
	fact := make([]mint, n+1, n+1)
	fact[0] = newMint(1)
	for i := 1; i <= n; i++ {
		fact[i] = fact[i-1].Mul(newMint(i))
	}

	inv := make([]mint, n+1, n+1)
	inv[n] = fact[n].Inverse()
	for i := n; i >= 1; i-- {
		inv[i-1] = inv[i].Mul(newMint(i))
	}

	f.fact = fact
	f.factInverse = inv
}

func (f *factorial) Get(n int) mint { return f.fact[n] }

func (f *factorial) GetInverse(n int) mint { return f.factInverse[n] }

func (f *factorial) Permutation(n, k int) mint {
	if k < 0 || n < k {
		return 0
	}
	return f.fact[n].Mul(f.factInverse[n-k])
}

func (f *factorial) Combination(n, k int) mint {
	if k < 0 || n < k {
		return 0
	}
	return f.fact[n].Mul(f.factInverse[k]).Mul(f.factInverse[n-k])
}

// sieve
type sieve struct {
	n          int
	primes     []int
	maxFactors []int
}

func newSieve(n int) *sieve {
	s := &sieve{
		n:          n,
		primes:     []int{},
		maxFactors: make([]int, n+1, n+1),
	}
	s.init()
	return s
}

func (s *sieve) init() {
	s.maxFactors[0] = -1
	s.maxFactors[1] = -1
	for i := 2; i <= s.n; i++ {
		if s.maxFactors[i] != 0 {
			continue
		}
		s.primes = append(s.primes, i)
		s.maxFactors[i] = i
		for j := i * i; j <= s.n; j += i {
			if s.maxFactors[j] == 0 {
				s.maxFactors[j] = i
			}
		}
	}
}

func (s *sieve) IsPrime(x int) bool { return s.maxFactors[x] == x }

func (s *sieve) Factor(x int) map[int]int {
	m := map[int]int{}
	for x != 1 {
		m[s.maxFactors[x]]++
		x /= s.maxFactors[x]
	}
	return m
}


//go:generate echo "https://atcoder.jp/contests/abc111/tasks/arc103_a"
package main

import (
	"bufio"
	"fmt"
	"io"
	"math/big"
	"os"
	"strconv"
)

var scan = newScanner(os.Stdin)

func solve(vs []int) int {
	mo, me := map[int]int{}, map[int]int{}
	for i, v := range vs {
		if i%2 == 0 { // odd
			mo[v]++
		} else { // even
			me[v]++
		}
	}
	ov1, oc1, oc2 := 0, 0, 0
	for v, c := range mo {
		if oc1 < c {
			oc2 = oc1
			oc1 = c
			ov1 = v
		}
	}
	ev1, ec1, ec2 := 0, 0, 0
	for v, c := range me {
		if ec1 < c {
			ec2 = ec1
			ec1 = c
			ev1 = v
		}
	}
	if ov1 != ev1 {
		return len(vs) - oc1 - ec1
	}
	return len(vs) - imax(oc1+ec2, ec1+oc2)
}

func main() {
	n := scan.Int()
	vs := scan.Ints(n)
	fmt.Println(solve(vs))
}

// scanner
type scanner struct {
	*bufio.Scanner
}

func newScanner(r io.Reader) *scanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	s.Buffer(nil, 100000000)
	return &scanner{s}
}

func (s *scanner) String() string { s.Scan(); return s.Text() }

func (s *scanner) Strings(l int) []string {
	if l == 0 {
		return []string{}
	}
	sl := make([]string, l, l)
	for i := range sl {
		sl[i] = s.String()
	}
	return sl
}

func (s *scanner) Int() int { n, _ := strconv.Atoi(s.String()); return n }

func (s *scanner) Ints(l int) []int {
	if l == 0 {
		return []int{}
	}
	sl := make([]int, l, l)
	for i := range sl {
		sl[i] = s.Int()
	}
	return sl
}

func (s *scanner) Float64() float64 { f, _ := strconv.ParseFloat(s.String(), 64); return f }

func (s *scanner) Float64s(l int) []float64 {
	if l == 0 {
		return []float64{}
	}
	sl := make([]float64, l, l)
	for i := range sl {
		sl[i] = s.Float64()
	}
	return sl
}

func (s *scanner) BigInt() *big.Int {
	n, _ := strconv.ParseInt(s.String(), 10, 64)
	return big.NewInt(n)
}

func (s *scanner) BigInts(l int) []*big.Int {
	if l == 0 {
		return []*big.Int{}
	}
	sl := make([]*big.Int, l, l)
	for i := range sl {
		sl[i] = s.BigInt()
	}
	return sl
}

func iabs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func imax(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func imin(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func ipow(x, n int) int {
	if n == 0 {
		return 1
	}
	a := ipow(x, n>>1)
	a *= a
	if n&1 != 0 {
		a *= x
	}
	return a
}

func ifact(x int) int {
	f := 1
	for i := 2; i <= x; i++ {
		f *= i
	}
	return f
}

func isum(X []int) int {
	s := 0
	for _, x := range X {
		s += x
	}
	return s
}

func chmax(x *int, v int) { *x = imax(*x, v) }

func chmin(x *int, v int) { *x = imin(*x, v) }

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int { return a * b / gcd(a, b) }

func factor(n int) map[int]int {
	m := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			n /= i
			m[i]++
		}
	}
	if n != 1 {
		m[n]++
	}
	return m
}

func perm(X []int) [][]int {
	makeCopy := func(X []int) []int { return append(make([]int, 0, len(X)), X...) }
	n := len(X)
	c := makeCopy(X)
	res := append(make([][]int, 0, ifact(n)), makeCopy(c))
	p := make([]int, n+1, n+1)
	for i := 0; i < n+1; i++ {
		p[i] = i
	}
	for i := 1; i < n; {
		p[i]--
		j := 0
		if i%2 == 1 {
			j = p[i]
		}
		c[i], c[j] = c[j], c[i]
		res = append(res, makeCopy(c))
		for i = 1; p[i] == 0; i++ {
			p[i] = i
		}
	}
	return res
}

func ndigit(x int) int {
	d := 0
	for ; x > 0; x /= 10 {
		d++
	}
	return d
}

// iheap
type iheap []int

func (h iheap) Len() int { return len(h) }

func (h iheap) Less(i, j int) bool { return h[i] < h[j] }

func (h iheap) Swap(i, j int) { h[i], h[j] = h[j], h[i] }

func (h *iheap) Push(x interface{}) { *h = append(*h, x.(int)) }

func (h *iheap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

// mint
type mint int

var mod = 1000000007

func setMintMod(x int) { mod = x }

func newMint(v int) mint { return mint((v%mod + mod) % mod) }

func (x mint) Add(y mint) mint {
	v := x + y
	if v >= mint(mod) {
		return v - mint(mod)
	}
	return v
}

func (x mint) Sub(y mint) mint {
	v := x + mint(mod) - y
	if v >= mint(mod) {
		return v - mint(mod)
	}
	return v
}

func (x mint) Mul(y mint) mint { return (x * y) % mint(mod) }

func (x mint) Pow(p int) mint {
	if p == 0 {
		return mint(1)
	}
	a := x.Pow(p >> 1)
	a = a.Mul(a)
	if p&1 != 0 {
		a = a.Mul(x)
	}
	return a
}

func (x mint) Inverse() mint { return x.Pow(mod - 2) }

func (x mint) Div(y mint) mint { return x.Mul(y.Inverse()) }

func (x mint) Neg() mint { return newMint(int(-x)) }

// factorial
type factorial struct {
	fact        []mint
	factInverse []mint
}

func newFactorial(n int) *factorial {
	f := new(factorial)
	f.init(n)
	return f
}

func (f *factorial) init(n int) {
	fact := make([]mint, n+1, n+1)
	fact[0] = newMint(1)
	for i := 1; i <= n; i++ {
		fact[i] = fact[i-1].Mul(newMint(i))
	}

	inv := make([]mint, n+1, n+1)
	inv[n] = fact[n].Inverse()
	for i := n; i >= 1; i-- {
		inv[i-1] = inv[i].Mul(newMint(i))
	}

	f.fact = fact
	f.factInverse = inv
}

func (f *factorial) Get(n int) mint { return f.fact[n] }

func (f *factorial) GetInverse(n int) mint { return f.factInverse[n] }

func (f *factorial) Permutation(n, k int) mint {
	if k < 0 || n < k {
		return 0
	}
	return f.fact[n].Mul(f.factInverse[n-k])
}

func (f *factorial) Combination(n, k int) mint {
	if k < 0 || n < k {
		return 0
	}
	return f.fact[n].Mul(f.factInverse[k]).Mul(f.factInverse[n-k])
}

// sieve
type sieve struct {
	n          int
	primes     []int
	maxFactors []int
}

func newSieve(n int) *sieve {
	s := &sieve{
		n:          n,
		primes:     []int{},
		maxFactors: make([]int, n+1, n+1),
	}
	s.init()
	return s
}

func (s *sieve) init() {
	s.maxFactors[0] = -1
	s.maxFactors[1] = -1
	for i := 2; i <= s.n; i++ {
		if s.maxFactors[i] != 0 {
			continue
		}
		s.primes = append(s.primes, i)
		s.maxFactors[i] = i
		for j := i * i; j <= s.n; j += i {
			if s.maxFactors[j] == 0 {
				s.maxFactors[j] = i
			}
		}
	}
}

func (s *sieve) IsPrime(x int) bool { return s.maxFactors[x] == x }

func (s *sieve) Factor(x int) map[int]int {
	m := map[int]int{}
	for x != 1 {
		m[s.maxFactors[x]]++
		x /= s.maxFactors[x]
	}
	return m
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func min(a ...int) int {
	m := a[0]
	for i, v := range a {
		if i == 0 {
			continue
		}
		if m > v {
			m = v
		}
	}
	return m
}

func max(a ...int) int {
	m := a[0]
	for i, v := range a {
		if i == 0 {
			continue
		}
		if m < v {
			m = v
		}
	}
	return m
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	// Code for C - /\/\/\/
	var n int
	fmt.Scan(&n)

	sc.Split(bufio.ScanWords)
	v := make([]int, n)
	temp1 := make(map[int]int, n)
	temp2 := make(map[int]int, n)

	var count1, count2 int
	for i := 0; i < n; i++ {
		v[i] = nextInt()
		if i%2 == 0 {
			temp1[v[i]]++
			count1++
		} else {
			temp2[v[i]]++
			count2++
		}
	}

	//fmt.Println(temp1, count1)
	//fmt.Println(temp2, count2)

	sortTemp1 := make([]int, 0)
	for _, v := range temp1 {
		sortTemp1 = append(sortTemp1, v)
	}
	sort.Sort(sort.Reverse(sort.IntSlice(sortTemp1)))

	var max1Num1, max2Num1 int
	for i, v := range temp1 {
		if v == sortTemp1[0] {
			max1Num1 = i
		} else if v == sortTemp1[1] {
			max2Num1 = i
		}
	}

	sortTemp2 := make([]int, 0)
	for _, v := range temp2 {
		sortTemp2 = append(sortTemp2, v)
	}
	sort.Sort(sort.Reverse(sort.IntSlice(sortTemp2)))

	//fmt.Println(sortTemp2)
	var max1Num2, max2Num2 int
	for i, v := range temp2 {
		if v == sortTemp2[0] {
			max1Num2 = i
		} else if v == sortTemp1[1] {
			max2Num2 = i
		}
	}

	//fmt.Println(temp1[max1Num1], temp2[max2Num1])
	if max1Num1 == max1Num2 {
		fmt.Println(min(count1-temp1[max1Num1]+count2-temp2[max2Num2], count1-temp1[max2Num1]+count2-temp2[max1Num2]))
		//fmt.Println("Test1")
	} else {
		fmt.Println(count1 - temp1[max1Num1] + count2 - temp2[max1Num2])
		//fmt.Println("Test2")
	}
}


INF = 10 ** 6
n = gets.chomp.to_i
nums = gets.chomp.split(" ").map(&:to_i)
odds = Array.new(10 ** 5 + 1, 0)
evens = Array.new(10 ** 5 + 1, 0)
nums.each_with_index do |num, index|
  if index.even?
    odds[num] += 1
  else
    evens[num] += 1
  end
end

odds_candidates = []
evens_candidates = []

2.times do
  odds_max = odds.index(odds.max)
  if odds[odds_max] == -1
    break
  else
    odds_candidates << [odds_max, n / 2 - odds[odds_max]]
    odds[odds_max] = -1
  end

  evens_max = evens.index(evens.max)
  if evens[evens_max] == -1
    break
  else
    evens_candidates << [evens_max, n / 2 - evens[evens_max]]
    evens[evens_max] = -1
  end
end

odds_candidates << [INF, n / 2]
evens_candidates << [INF, n / 2]

mins = []

odds_candidates.each do |odds_candidate|
  evens_candidates.each do |evens_candidate|
    if odds_candidate[0] == evens_candidate[0]
      next
    else
      mins << odds_candidate[1] + evens_candidate[1]
    end
  end
end

puts mins.min


nu = gets.to_i
array = gets.chomp.split(' ').map(&:to_i)
count1 = []
count2 = []
(0..nu - 1).each do |i|
  if i.even?
    count1.push(array[i])
  else
    count2.push(array[i])
  end
end
count3 = Array.new(10**5 + 1, 0)
count4 = Array.new(10**5 + 1, 0)

(0..count1.length - 1).each do |i|
  count3[count1[i]] += 1
end
(0..count1.length - 1).each do |i|
  count4[count2[i]] += 1
end

check1 = [0, 0]
check2 = [0, 0]
check3 = [0, 0]
check4 = [0, 0]
(1..10**5).each do |i|
  if check1[1] < count3[i]
    check1[1] = count3[i]
    check1[0] = i
  end
  if check2[1] < count4[i]
    check2[1] = count4[i]
    check2[0] = i
  end
end
(1..10**5).each do |i|
  if check3[1] < count3[i] && i != check1[0]
    check3[1] = count3[i]
    check3[0] = i
  end
  if check4[1] < count4[i] && i != check2[0]
    check4[1] = count4[i]
    check4[0] = i
  end
end

if check1[0] != check2[0]
  puts (count1.length - check1[1]) + (count2.length - check2[1])
  exit
end

if (check1[1] + check4[1]) > (check2[1] + check3[1])
  puts (count1.length - check1[1]) + (count2.length - check4[1])
else
  puts (count1.length - check3[1]) + (count2.length - check2[1])
end


n=gets.to_i
v=gets.split.map(&:to_i)
he=[0]*(10**5+1)
ho=[0]*(10**5+1)
n.times do |i|
  if i.even?
    he[v[i]]+=1
  else
    ho[v[i]]+=1
  end
end
hemv = he.max
homv = ho.max
hemk = he.index(he.max)
homk = ho.index(ho.max)
if hemk == homk
  he[hemk]=0
  ho[homk]=0
  if he==[0]*(10**5+1)
    hhemv=0
  else
    hhemv = he.max
  end
  if ho==[0]*(10**5+1)
    hhomv=0
  else
    hhomv = ho.max
  end
  puts n-[hemv+hhomv,homv+hhemv].max
else
  puts n-hemv-homv
end


def hahs_sort_desc(hash)
  hash.sort {|a,b| a[1]<=>b[1]}.reverse
end

def max_key(hash)
  hash = hahs_sort_desc(hash)
  hash[0][0]
end

def func(hash, exclude_key = nil)
  res = 0
  if exclude_key
    # 2つ目の計算
    keys = hash.keys
    max_key = max_key(hash)

    if max_key == exclude_key
      if keys.size == 1
        res = hash.first[1]
      else
        hash = hahs_sort_desc(hash)
        target_key = hash[1][0]
        hash.each{|k,v| res += v if k != target_key}
      end
    else
      if keys.size != 1
        hash = hahs_sort_desc(hash)
        hash[1..-1].each{|k,v| res += v}
      end
    end
  else
    if hash.keys.size != 1
      hash = hahs_sort_desc(hash)
      hash[1..-1].each{|k,v| res += v}
    end
  end
  res
end

_ = gets.to_i
a = []
b = []
x = Hash.new(0)
y = Hash.new(0)
gets.chomp.split.each_with_index do |s, i|
  s = s.to_i
  if i.even?
    a << s
    x[s] += 1
  else
    b << s
    y[s] += 1
  end
end

puts func(x) + func(y, max_key(x))


def hahs_sort_desc(hash)
  hash.sort {|a,b| a[1]<=>b[1]}.reverse
end

def max_key(hash)
  hash = hahs_sort_desc(hash)
  hash[0][0]
end

def func(hash, exclude_key = nil)
  res = 0
  if exclude_key
    # 2つ目の計算
    keys = hash.keys
    max_key = max_key(hash)

    if max_key == exclude_key
      if keys.size == 1
        res = hash.first[1]
      else
        hash = hahs_sort_desc(hash)
        target_key = hash[1][0]
        hash.each{|k,v| res += v if k != target_key}
      end
    else
      hash[1..-1].each{|k,v| res += v}
    end
  else
    if hash.keys.size != 1
      hash = hahs_sort_desc(hash)
      hash[1..-1].each{|k,v| res += v}
    end
  end
  res
end

_ = gets.to_i
a = []
b = []
x = Hash.new(0)
y = Hash.new(0)
gets.chomp.split.each_with_index do |s, i|
  s = s.to_i
  if i.even?
    a << s
    x[s] += 1
  else
    b << s
    y[s] += 1
  end
end

puts func(x) + func(y, max_key(x))


def max_key(hash)
  hash = hash.sort {|a,b| a[1]<=>b[1]}.reverse
  hash[0][0]
end

def func(hash, exclude_key = nil)
  res = 0
  if hash.keys.size != 1
    hash = hash.sort {|a,b| a[1]<=>b[1]}.reverse
    if exclude_key
      hash.each{|k,v| res += v if k != exclude_key}
    else
      hash[1..-1].each{|k,v| res += v}
    end
  elsif exclude_key
    res = hash.first[1]
  end
  res
end

_ = gets.to_i
a = []
b = []
x = Hash.new(0)
y = Hash.new(0)
gets.chomp.split.each_with_index do |s, i|
  s = s.to_i
  if i.even?
    a << s
    x[s] += 1
  else
    b << s
    y[s] += 1
  end
end

if a == b
  puts func(x) + func(y, max_key(x))
else
  puts func(x) + func(y)
end


fn main() {
    let mut buf: String = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let n: usize = buf.trim().parse::<usize>().unwrap();
    let mut v1: Vec<usize> = vec![0; 100001];
    let mut v2: Vec<usize> = vec![0; 100001];
    let mut buf: String = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut itr = buf.split_whitespace();
    while let Some(i) = itr.next() {
        v1[i.parse::<usize>().unwrap()] += 1;
        if let Some(i) = itr.next() {
            v2[i.parse::<usize>().unwrap()] += 1;
        }
    }
    let (mut m11,mut m12,mut m21,mut m22,mut m31,mut m32): (usize,usize,usize,usize,usize,usize) = (0,0,0,0,0,0);
    for x in 0..100001 {
        if v1[x] > m12 {
            if v1[x] > m11 {
                m12 = m11;
                m11 = v1[x];
                m31 = x;
            } else {
                m12 = v1[x];
            }
        }
        if v2[x] > m22 {
            if v2[x] > m21 {
                m22 = m21;
                m21 = v2[x];
                m32 = x;
            } else {
                m22 = v2[x];
            }
        }
    }
    println!("{}", if m31 != m32 {n-m11-m21} else {std::cmp::min(n-m11-m22,n-m12-m21)});
}


// input macro
// ref: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_mut)]
fn main() {
    input!(
        n: usize,
        v: [usize; n],
    );

    let mx = 10_usize.pow(5) + 1;
    let mut odd: Vec<usize> = vec![0; mx];
    let mut even: Vec<usize> = vec![0; mx];

    for (i, &vi) in v.iter().enumerate() {
        if i%2 == 0 {
            odd[vi] += 1;
        }
        else {
            even[vi] += 1;
        }
    }

    let mut oddfirst = (0,0);
    let mut oddsecond = (0,0);
    for (oi, &oddi) in odd.iter().enumerate() {
        if oddi > oddfirst.1 {
            oddsecond = oddfirst.clone();
            oddfirst = (oi, oddi);
        }
        else if oddi > oddsecond.1 {
            oddsecond = (oi, oddi);
        }
    }

    let mut evenfirst = (0,0);
    let mut evensecond = (0,0);
    for (ei, &eveni) in even.iter().enumerate() {
        if eveni > evenfirst.1 {
            evensecond = evenfirst.clone();
            evenfirst = (ei, eveni);
        }
        else if eveni > evensecond.1 {
            evensecond = (ei, eveni);
        }
    }

    if oddfirst.0 == evenfirst.0 {
        if oddsecond.1 > evensecond.1 {
            println!("{}", n - evenfirst.1 - oddsecond.1);
        }
        else {
            println!("{}", n - oddfirst.1 - evensecond.1);
        }
    }
    else {
        println!("{}", n - oddfirst.1 - evenfirst.1);
    }

}


use std::collections::HashMap;

#[allow(unused_macros)]
macro_rules! get {
    ([$t:ty] ; $n:expr) => {
        (0..$n)
        .map(|_| get!([$t])).collect::<Vec<_>>()
    };
    ($($t:ty),+ ; $n:expr) => {
        (0..$n).map(|_| get!($($t),+)).collect::<Vec<_>>()
    };
    ([$t:ty]) => {
        rl().split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect::<Vec<$t>>()
    };
    ($t:ty) => {
        rl().parse::<$t>().unwrap()
    };
    ($($t:ty),*) => {
        {
            let line =rl();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap()),*)
        }
    };
}
fn rl() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let n = get!(usize);
    let v = get!([usize]);
    let mut even = HashMap::with_capacity(n / 2);
    let mut odd = HashMap::with_capacity(n / 2);
    for (i, x) in v.iter().enumerate() {
        if i % 2 == 0 {
            let counter = even.entry(x).or_insert(0);
            *counter += 1;
        } else {
            let counter = odd.entry(x).or_insert(0);
            *counter += 1;
        }
    }
    let mut e_max_val = 0;
    let mut e_second_val = 0;
    let mut key_of_e_max_val = 0;
    for (key, val) in even.iter() {
        if e_max_val <= *val {
            key_of_e_max_val = **key;
            e_second_val = e_max_val;
            e_max_val = *val;
        } else if e_second_val <= *val {
            e_second_val = *val;
        }
    }
    let mut o_max_val = 0;
    let mut o_second_val = 0;
    let mut key_of_o_max_val = 0;
    for (key, val) in odd.iter() {
        if o_max_val <= *val {
            key_of_o_max_val = **key;
            o_second_val = o_max_val;
            o_max_val = *val;
        } else if o_second_val <= *val {
            o_second_val = *val;
        }
    }
    //eprintln!(
    //    "key_of_e_max_val: {}, e_max_val: {}, e_second_val: {}",
    //    key_of_e_max_val, e_max_val, e_second_val
    //);
    //eprintln!(
    //    "key_of_o_max_val: {}, o_max_val: {}, o_second_val: {}",
    //    key_of_o_max_val, o_max_val, o_second_val
    //);
    if key_of_e_max_val != key_of_o_max_val {
        println!("{}", n - e_max_val - o_max_val);
    } else {
        println!(
            "{}",
            std::cmp::min(n - e_max_val - o_second_val, n - e_second_val - o_max_val)
        );
    }
}


#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use nalgebra::max;

fn main() {
    input! {
    n: usize,
    v: [usize; n]
    }
    let mut ec = vec![0; 100005];
    let mut oc = vec![0; 100005];
    for i in 0..n {
        if i % 2 == 0 {
            ec[v[i]] += 1;
        } else {
            oc[v[i]] += 1;
        }
    }
    let (mut em, mut om) = (0, 0);
    let (mut sem, mut som) = (0, 0);
    for i in 0..100005 {
        if ec[em] <= ec[i] {
            sem = em;
            em = i;
        }
        if oc[om] <= oc[i] {
            som = om;
            om = i;
        }
    }
    let ans = ec.iter().sum::<usize>() + oc.iter().sum::<usize>()
        - if em == om || em == som || om == sem {
        max(ec[em] + oc[som], ec[sem] + oc[om])
    } else {
        ec[em] + oc[om]
    };
    println!("{}", ans);
}


#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use nalgebra::max;

fn main() {
    input! {
    n: usize,
    v: [usize; n]
    }
    let mut ec = vec![0; 100005];
    let mut oc = vec![0; 100005];
    for i in 0..n {
        if i % 2 == 0 {
            ec[v[i]] += 1;
        } else {
            oc[v[i]] += 1;
        }
    }
    let (mut em, mut om) = (0, 0);
    let (mut sem, mut som) = (0, 0);
    for i in 0..100005 {
        if ec[em] <= ec[i] {
            sem = em;
            em = i;
        }
        if oc[om] <= oc[i] {
            som = om;
            om = i;
        }
    }
    let ans = ec.iter().sum::<usize>() + oc.iter().sum::<usize>()
        - if em == om {
        max(ec[em] + oc[som], ec[sem] + oc[om])
    } else {
        ec[em] + oc[om]
    };
    println!("{}", ans);
}


#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;

fn main() {
    input! {
    n: usize,
    v: [usize; n]
    }
    let mut ec = vec![0; 100005];
    let mut oc = vec![0; 100005];
    for i in 0..n {
        if i % 2 == 0 {
            ec[v[i]] += 1;
        } else {
            oc[v[i]] += 1;
        }
    }
    let (mut em, mut om) = (0, 0);
    let (mut sem, mut som) = (0, 0);
    for i in 0..100005 {
        if ec[em] <= ec[i] {
            sem = em;
            em = i;
        }
        if oc[om] <= oc[i] {
            som = om;
            om = i;
        }
    }
    let ans = ec.iter().sum::<usize>() + oc.iter().sum::<usize>()
        - if em == om {
        if ec[em] > oc[om] {
            ec[em] + oc[som]
        } else {
            ec[sem]+ oc[om]
        }
    } else {
        ec[em] + oc[om]
    };
    println!("{}", ans);
}


// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}

func readLines() -> [String] {
    return readLine()!.map { String($0) }
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

///最大公約数を返す
func gcd(_ array: [Int]) -> Int {
    var value = array[0]
    if array.count > 1 {
        for i in 1..<array.count {
            value = gcd(value, array[i])
        }
    }
    return value
}

///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    let g = gcd(m, n)
    return m / g * n
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {

    mutating func remove(_ element: Element) {
        _ = firstIndex(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt

    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2

        if Int(ary[mid])! < key {
            left = mid

        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }

    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}
// https://algo-logic.info/divisor/
/// 約数の配列を返す
func divisor(_ n:Int) -> [Int] {
    var ret = [Int]()
    var i = 1
    while i * i <= n {
        if n % i == 0 {
            ret.append(i)
            if i * i != n {
                ret.append(n / i)
            }
        }
        i += 1
    }
    return ret.sorted()
}

/// 1〜nまでの数字からなる辞書順列のm番目の順列を返す
func permutation(_ n: Int, _ m: Int) -> [Int] {
    var m = m

    var temp = [Int](repeating: 0, count: n)
    var surplus = [Int](repeating: 0, count: n)

    for i in 1...n {
        temp[i - 1] = i

        surplus[n - i] = m % i
        m = m / i
    }

    var order = [Int](repeating: 0, count: n)

    for i in 0..<n {
        order[i] = temp[surplus[i]]
        var j = surplus[i]
        while j + 1 < n {
            temp[j] = temp[j + 1]
            j += 1
        }
    }
    return order
}
func mod() -> Int {
    return Int(pow(10.0, 9.0)) + 7
}

func nPk(_ n: Int, _ k: Int) -> Int {
    var (n, k) = (n, k)
    var res = 1
    while k > 0 {
        res *= n
        res %= mod()
        n -= 1
        k -= 1
    }
    return res
}

func main() {
    let n = readInt()
    let v = readInts()
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    var even = [[Int]](repeating: [Int](repeating: 0, count: 2), count: 100000)
    var odd = [[Int]](repeating: [Int](repeating: 0, count: 2), count: 100000)

    for i in 0..<n {
        if i % 2 == 0 {
            even[v[i] - 1][0] = v[i]
            even[v[i] - 1][1] += 1
        } else {
            odd[v[i] - 1][0] = v[i]
            odd[v[i] - 1][1] += 1
        }
    }
    even.sort { $0[1] > $1[1] }
    odd.sort { $0[1] > $1[1] }

    var ans = 0
    if even[0][0] == odd[0][0] {
        ans = n - max(even[0][1] + odd[1][1], even[1][1] + odd[0][1])
    } else {
        ans = n - (even[0][1] + odd[0][1])
    }
    print(ans)
}
main()


let n = Int(readLine()!)!
let v = readLine()!.characters.split(" ").map{Int(String($0))!}
var num = (0..<2).map{_ in (0..<100000).map{_ in 0}}
for (i, vi) in v.enumerate() {
    num[i%2][vi-1] += 1
}
var first = [0, 0]
var second = [0, 0]
for i in 0..<100000 {
    for j in 0..<2 {
        if num[j][i] > first[j] {
            (first[j], second[j]) = (num[j][i], first[j])
        } else if num[j][i] > second[j] {
            second[j] = num[j][i]
        }
    }
}
if num[0].indexOf(first[0]) != num[1].indexOf(first[1]) {
    print(n - (first[0]+first[1]))
} else {
    print(n - max(first[0]+second[1], second[0]+first[1]))
}


let n = Int(readLine()!)!
let v = readLine()!.characters.split(" ").map{Int(String($0))!}
var num = (0..<2).map{_ in (0..<100000).map{_ in 0}}
for (i, vi) in v.enumerate() {
    num[i%2][vi-1] += 1
}
let sortedNum = num.map{$0.sort(>)}
let maxNum = (0..<2).map{sortedNum[$0][0]}
if num[0].indexOf(maxNum[0]) != num[1].indexOf(maxNum[1]) {
    print(n - (maxNum[0] + maxNum[1]))
} else {
    print(n - max(maxNum[0]+sortedNum[1][1], sortedNum[0][1]+maxNum[1]))
}


// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}

func readLines() -> [String] {
    return readLine()!.map { String($0) }
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

///最大公約数を返す
func gcd(_ array: [Int]) -> Int {
    var value = array[0]
    if array.count > 1 {
        for i in 1..<array.count {
            value = gcd(value, array[i])
        }
    }
    return value
}

///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    let g = gcd(m, n)
    return m / g * n
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {

    mutating func remove(_ element: Element) {
        _ = firstIndex(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt

    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2

        if Int(ary[mid])! < key {
            left = mid

        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }

    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}
// https://algo-logic.info/divisor/
/// 約数の配列を返す
func divisor(_ n:Int) -> [Int] {
    var ret = [Int]()
    var i = 1
    while i * i <= n {
        if n % i == 0 {
            ret.append(i)
            if i * i != n {
                ret.append(n / i)
            }
        }
        i += 1
    }
    return ret.sorted()
}

/// 1〜nまでの数字からなる辞書順列のm番目の順列を返す
func permutation(_ n: Int, _ m: Int) -> [Int] {
    var m = m

    var temp = [Int](repeating: 0, count: n)
    var surplus = [Int](repeating: 0, count: n)

    for i in 1...n {
        temp[i - 1] = i

        surplus[n - i] = m % i
        m = m / i
    }

    var order = [Int](repeating: 0, count: n)

    for i in 0..<n {
        order[i] = temp[surplus[i]]
        var j = surplus[i]
        while j + 1 < n {
            temp[j] = temp[j + 1]
            j += 1
        }
    }
    return order
}
func mod() -> Int {
    return Int(pow(10.0, 9.0)) + 7
}

func nPk(_ n: Int, _ k: Int) -> Int {
    var (n, k) = (n, k)
    var res = 1
    while k > 0 {
        res *= n
        res %= mod()
        n -= 1
        k -= 1
    }
    return res
}

func main() {
    let n = readInt()
    let v = readInts()
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    var even = [[Int]](repeating: [Int](repeating: 0, count: 2), count: 100000)
    var odd = [[Int]](repeating: [Int](repeating: 0, count: 2), count: 100000)

    for i in 0..<n {
        if i % 2 == 0 {
            even[v[i] - 1][0] = v[i]
            even[v[i] - 1][1] += 1
        } else {
            odd[v[i] - 1][0] = v[i]
            odd[v[i] - 1][1] += 1
        }
    }
    even.sort { $0[1] > $1[1] }
    odd.sort { $0[1] > $1[1] }

    var cntEven = 0
    var cntOdd = 0

    // even[0][0] == odd[0][0]であった場合のカウンター
    var subCntEven = 0
    var subCntOdd = 0

    for i in 0..<n {
        if i % 2 == 0 {
            if even[0][0] != v[i] {
                cntEven += 1
            } else if even[1][0] != v[i] {
                subCntEven += 1
            }
        } else {
            if odd[0][0] != v[i] {
                cntOdd += 1
            } else if odd[1][0] != v[i] {
                subCntOdd += 1
            }
        }
    }
    var ans = 0
    if even[0][0] == odd[0][0] {
        if cntEven + subCntEven < cntOdd + subCntOdd {
            ans += cntEven + subCntOdd
        } else {
            ans += subCntEven + cntOdd
        }
    } else {
        ans += cntEven + cntOdd
    }
    print(ans)
}
main()


let n = Int(readLine()!)!
let v = readLine()!.characters.split(" ").map{Int(String($0))!}
var num = (0..<2).map{_ in (0..<100000).map{_ in 0}}
for (i, vi) in v.enumerate() {
    num[i%2][vi-1] += 1
}
let sortedNum = num.map{$0.filter{$0>0}.sort(>)}
let maxNum = (0..<2).map{sortedNum[$0][0]}
if num[0].indexOf(maxNum[0]) != num[1].indexOf(maxNum[1]) {
    print(n - (maxNum[0] + maxNum[1]))
} else {
    print(n - max(maxNum[0]+sortedNum[1][1], sortedNum[0][1]+maxNum[1]))
}


const stdin = require('fs').readFileSync('/dev/stdin', 'utf8')

const n = Number(stdin.split('\n')[0])

const v = stdin
  .split('\n')[1]
  .split(' ')
  .map(Number)

const getHighFreqSeq = _ => {
  let euniqsObj = {}
  let euniqs = []
  let eseqs = []
  let emax = 0
  let emaxi = 0

  let ouniqsObj = {}
  let ouniqs = []
  let oseqs = []
  let omax = 0
  let omaxi = 0

  for (let i = 0; i < v.length; i++) {
    if (i % 2 === 0) {
      const euniqIdx = euniqsObj[v[i]]
      if (euniqIdx === undefined) {
        euniqs.push(v[i])
        euniqsObj[v[i]] = euniqs.length-1
        eseqs.push(1)
      } else {
        eseqs[euniqIdx]++
        if (eseqs[euniqIdx] > emax) {
          emax = eseqs[euniqIdx]
          emaxi = euniqIdx
        }
      }
    } else {
      const ouniqIdx = ouniqsObj[v[i]]
      if (ouniqIdx === undefined) {
        ouniqs.push(v[i])
        ouniqsObj[v[i]] = ouniqs.length-1
        oseqs.push(1)
      } else {
        oseqs[ouniqIdx]++
        if (oseqs[ouniqIdx] > omax) {
          omax = oseqs[ouniqIdx]
          omaxi = ouniqIdx
        }
      }
    }
  }

  return {
    e: {
      max: emax,
      maxi: emaxi,
      seqs: eseqs,
      uniqs: euniqs,
    },

    o: {
      max: omax,
      maxi: omaxi,
      seqs: oseqs,
      uniqs: ouniqs,
    },
  }
}

const res = _ => {
  const { e, o } = getHighFreqSeq()

  const eMIdx = e.maxi
  const oMIdx = o.maxi
  const eMaxFreq = e.uniqs[eMIdx]
  const oMaxFreq = o.uniqs[oMIdx]

  e.seqs.sort((a, b) => b - a)
  o.seqs.sort((a, b) => b - a)

  let esum = 0
  let esum2 = 0
  let osum = 0
  let osum2 = 0

  for (let i = 0; ; i++) {
    if (i !== 0 && e.seqs.length > i) {
      esum += e.seqs[i]
    }
    if (i !== 1 && e.seqs.length > i) {
      esum2 += e.seqs[i]
    }

    if (i !== 0 && o.seqs.length > i) {
      osum += o.seqs[i]
    }
    if (i !== 1 && o.seqs.length > i) {
      osum2 += o.seqs[i]
    }

    if (e.seqs.length <= i && o.seqs.length <= i) {
      break
    }
  }

  if (eMaxFreq === oMaxFreq) {
    return Math.min(esum + osum2, esum2 + osum)
  } else {
    return esum + osum
  }
}

console.log(res())


const p = (...args) => {
  process.env.NODE_ENV === "test" ? console.log(...args) : ""
}

const tupple = (obj, mark) => {
  return Object.keys(obj).map((key) => {
    const value = obj[key]
    return {
      key,
      value,
      mark
    }
  })
  // .sort((a, b) => b.value - a.value)
}

const calc = (n, a, b) => {
  if (a[0].key !== b[0].key) {
    return n - a[0].value - b[0].value
  }
  if (b.length > 1) {
    return n - a[0].value - b[1].value
  }
  return n - a[0].value
}
const solve = (input) => {
  let [n, rest] = input.split("\n")

  // let odd = []
  let oddNum = {}
  // let even = []
  let evenNum = {}
  const vs = rest.split(" ").map(Number)
  n = vs.length
  vs.forEach((v, i) => {
    if (i % 2 == 0) {
      // even.push(v)
      evenNum[v] = (evenNum[v] || 0) + 1
    } else {
      // odd.push(v)
      oddNum[v] = (oddNum[v] || 0) + 1
    }
  })
  const odd2 = tupple(oddNum).sort((a, b) => b.value - a.value)
  const even2 = tupple(evenNum).sort((a, b) => b.value - a.value)
  return Math.min(calc(n, odd2, even2), calc(n, even2, odd2))
}

if (process.env.NODE_ENV === "test") {
  module.exports = (input) => solve(input.trim())
} else {
  const input = require("fs").readFileSync("/dev/stdin", "utf8")
  console.log(solve(input.trim()))
}