let number_of states =
try
let test accu = match states with
| [] -> raise Zero
| [s] -> (fun state -> if s = state then succ accu else accu)
| [s1;s2] -> (fun state -> if state=s1||state=s2 then succ accu else accu)
| _ -> (fun state -> if List.mem state states then succ accu else accu)
in
fun configuration ->
Array.fold_left test 0 configuration
with Zero -> fun configuration -> 0