#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

const int N = 1e6 + 5;
int n, a[N], b[N], cnt[N];

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) scanf("%d", &a[i]), b[i] = a[i];
    std::sort(b + 1, b + 1 + n);
    int m = unique(b + 1, b + 1 + n) - b - 1, ans = 0;
    for (int i = 1; i <= n; ++i) a[i] = std::lower_bound(b + 1, b + 1 + m, a[i]) - b;
    int tmp = 0;
    for (int i = 1; i <= n; i += 2) ++cnt[a[i]];
    for (int i = 1; i <= n; i += 2) tmp = std::max(tmp, cnt[a[i]]);
    ans += (n + 1) / 2 - tmp;
    memset(cnt, 0, sizeof(cnt));
    tmp = 0;
    for (int i = 2; i <= n; i += 2) ++cnt[a[i]];
    for (int i = 2; i <= n; i += 2) tmp = std::max(tmp, cnt[a[i]]);
    printf("%d\n", ans + n / 2 - tmp);
    return 0;
}