Problem:
Score : 400 points

Problem Statement

Snuke has decided to play a game using cards.
He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written.

He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept.

Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.

Constraints

3 ≦ N ≦ 10^{5}

N is odd.

1 ≦ A_i ≦ 10^{5}

A_i is an integer.

Input

The input is given from Standard Input in the following format:

N
A_1 A_2 A_3 ... A_{N}

Output

Print the answer.

Sample Input 1

5
1 2 1 3 7

Sample Output 1

3

One optimal solution is to perform the operation once, taking out two cards with 1 and one card with 2. One card with 1 and another with 2 will be eaten, and the remaining card with 1 will be returned to deck. Then, the values written on the remaining cards in the deck will be pairwise distinct: 1, 3 and 7.

Sample Input 2

15
1 3 5 2 1 3 2 8 8 6 2 6 11 1 1

Sample Output 2

7

Solution in Rust (1.15.1) (judge verdict: Accepted)

///////////////////////////////////////////// Template /////////////////////////////////////////////
#![allow(non_snake_case, unused_imports)]
use std::io::Write;
use std::collections::*;
use template::*;

#[macro_use]
pub mod template {
	macro_rules! debug {
	    ($($v: expr),*) => {
	    	$(let _ = write!(std::io::stderr(), "{} = {:?} ", stringify!($v), $v);)*
	        let _ = writeln!(std::io::stderr(), "@ {}:{}", file!(), line!());
	    }
	}
	macro_rules! mat {
		($e:expr) => { $e };
		($e:expr; $d:expr $(; $ds:expr)*) => { vec![mat![$e $(; $ds)*]; $d] };
	}
	pub trait FromLn {
		fn fromln(s: &str) -> Self;
	}	
	pub fn readln<T: FromLn>() -> T {
		let mut buf = String::new();
		let _ = ::std::io::stdin().read_line(&mut buf).unwrap();
		T::fromln(buf.trim())
	}
	pub fn readlns<T: FromLn>(n: usize) -> Vec<T> {
		let mut vs = vec![];
		for _ in 0..n { vs.push(readln()); }
		vs
	}
	macro_rules! fromln_primitives {
		($($t:ty),*) => { $(
			impl FromLn for $t {
				fn fromln(s: &str) -> $t {
					s.parse().unwrap()
				}
			}
		)* }
	}
	fromln_primitives!(String, bool, f32, f64, isize, i8, i16, i32, i64, usize, u8, u16, u32, u64);
	impl<T> FromLn for Vec<T> where T: FromLn {
		fn fromln(s: &str) -> Vec<T> {
			s.split_whitespace().map(T::fromln).collect()
		}
	}
	impl FromLn for Vec<char> {
		fn fromln(s: &str) -> Vec<char> {
			s.chars().collect()
		}
	}
	macro_rules! fromln_tuple {
		($($t:ident: $i:expr),*; $n:expr) => {
			impl<$($t),*> FromLn for ($($t),*) where $($t: FromLn),* {
				fn fromln(s: &str) -> ($($t),*) {
					let ss = s.split_whitespace().collect::<Vec<_>>();
					assert_eq!(ss.len(), $n);
					($($t::fromln(ss[$i])),*)
				}
			}
		}
	}
	fromln_tuple!(A:0, B:1; 2);
	fromln_tuple!(A:0, B:1, C:2; 3);
	fromln_tuple!(A:0, B:1, C:2, D:3; 4);
	pub trait SetMin {
		fn setmin(&mut self, v: Self) -> bool;
	}
	impl<T> SetMin for T where T: PartialOrd {
		fn setmin(&mut self, v: T) -> bool {
			*self > v && { * self = v; true }
		}
	}
	pub trait SetMax {
		fn setmax(&mut self, v: Self) -> bool;
	}
	impl<T> SetMax for T where T: PartialOrd {
		fn setmax(&mut self, v: T) -> bool {
			*self < v && { * self = v; true }
		}
	}
}
fn main() {
	let _ = writeln!(std::io::stderr(), "----- {} -----", file!());
	let _ = std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}
////////////////////////////////////////////////////////////////////////////////////////////////////

fn run() {
	let n: usize = readln();
	let mut A: Vec<i32> = readln();
	A.sort();
	A.dedup();
	let d = n - A.len();
	println!("{}", A.len() - d % 2);
}