Proof with auto.
induction l.
intros.
elimtype False...
simpl.
intros.
destruct (in_app_or _ _ _ H).
exists a.
split...
destruct (IHl H0).
destruct H1.
exists x0...
Qed.
Definition eq_count X (d: forall (x y: X), { x = y } + { x <> y }) (x: X): list X -> nat :=
count (fun y => unsum_bool (d x y)).

Lemma eq_count_0 X (d: forall (x y: X), { x = y } + { x <> y }) (x: X) l:
~ In x l -> eq_count d x l = 0%nat.