import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!int).array;

    auto odd = A.map!(a => a % 2).sum;
    auto even = A.map!(a => 1 - a % 2).sum;

    if (odd == 0 || even == 0) {
        writeln(0);
    } else if (odd % 2 == 1) {
        writeln(N - 1);
    } else {
        writeln(N - 2);
    }
}

