import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    auto n = readln.chomp.to!int;
    auto vs = readln.split.to!(int[]);
    int[] a, b;
    vs.chunks(2).each!((v) {
        a ~= v[0];
        if (v.length > 1) b ~= v[1];
    });
    auto ga = a.sort().group().array.sort!((a,b) => a[1] < b[1]);
    auto gb = b.sort().group().array.sort!((a,b) => a[1] < b[1]);

    auto aMax = ga[$-1];
    auto bMax = gb[$-1];

    if (aMax[0] != bMax[0]) {
        writeln(a.length - aMax[1] + b.length - bMax[1]);
    } else {
        auto res = size_t.max;
        if (gb.length > 1) res = min(res, a.length - aMax[1] + b.length - gb[$-2][1]);
        if (ga.length > 1) res = min(res, a.length - ga[$-2][1] + b.length - bMax[1]);
        if (res == size_t.max) res = b.length;
        writeln(res);
    }
}

