induction l; simpl; intros.
elimtype False...
inversion_clear H.
subst.
rewrite H0...
destruct (p a)...
Qed.
End count.
Hint Resolve @count_le.

Lemma NoDup_map_inv' A B (f: A -> B) (l: list A): NoDup (map f l) -> NoDup l.
Proof with auto.