"use strict";
function Main(input) {
    let lines = input.split("\n");
    let N = lines.shift() - 0;
    let Vc = lines[0].split(/\s/).map((v) => v - 0);
    let a = {};
    for (let v of Vc) {
        let b = a[v] || 0;
        a[v] = b + 1;
    }
    let c = [];
    for (let v in a) {
        c.push({value:v, count:a[v]});
    }
    c.sort((a, b) => b.count - a.count);

    let ans = 0;
    let n = N / 2;
    for (let v of c) {
        ans += Math.abs(n - v.count);
    }

    console.log(ans);
}

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