let n = stdin.ReadLine () |> int let a = stdin.ReadLine().Split " " |> Array.map int |> Array.sort [| for i in 0..a.Length-1 -> if i = 0 then a.[i] <> a.[i+1] elif i = a.Length-1 then a.[i] <> a.[i-1] else a.[i] <> a.[i-1] && a.[i] <> a.[i+1] |] |> Array.filter id |> Array.length |> printfn "%d"