import std.stdio, std.string, std.algorithm, std.range, std.conv, std.typecons, std.math;
void main(){
    auto N = readln.chomp.to!int;
    auto As = readln.split.to!(int[]);
    auto groups = sort(As).group.array;
    ulong single = groups.length;
    auto multi = As.length - groups.length;
    writeln(single + (multi+1) % 2 - 1);
}