let rec remove value lst =
	let rec remove_non_dec value lst =
		match lst with
		| []      -> []
		| x :: xs ->
			if x >= value then remove_non_dec x xs
			else x :: xs
	in
	let rec remove_non_inc value lst =
		match lst with
		| []      -> []
		| x :: xs ->
			if x <= value then remove_non_inc x xs
			else x :: xs
	in
	match lst with
	| []      -> []
	| x :: xs ->
		if x > value then remove_non_dec x xs
		else if x < value then remove_non_inc x xs
		else remove x xs

let rec solve count lst =
	match lst with
	| []      -> count
	| x :: xs -> solve (count + 1) (remove x xs)

let () =
	let n = read_int () in
	let a =
		read_line ()
		|> Str.split (Str.regexp " ")
		|> List.map int_of_string
	in
	solve 0 a
	|> print_int
	|> print_newline
