let nb_sub_hom1_d e s =
let n = ref 0 in
let was_e = ref false in
let rec loop s =
match s with
[] -> if !was_e then incr n
| e'::s' ->
if (e' = e) then
if !was_e then (loop s')
else (was_e := true; (loop s'))
else
if (!was_e) then (was_e := false; incr n; loop s')
else (loop s')
in
(loop s);
!n