module IntOrd = struct
  type t = int
  let compare a b = a - b
end

module IntSet = Set.Make (IntOrd)

let unique_count xs =
  let s = List.fold_left (fun s x -> IntSet.add x s) IntSet.empty xs in
  IntSet.cardinal s

;;

unique_count [3; 1; 4; 1; 5; 9; 2; 6; 5; 3; 5; 8; 9; 7; 9]
