Were M4 and M5 executive produced by a film 's executive producer and written by a star of M1 , M2 , and M3
SELECT count(*) WHERE {
?x0 ns:film.producer.films_executive_produced ?x1 .
?x1 a ns:film.film .
?x2 ns:film.actor.film/ns:film.performance.film M1 .
?x2 ns:film.actor.film/ns:film.performance.film M2 .
?x2 ns:film.actor.film/ns:film.performance.film M3 .
M4 ns:film.film.executive_produced_by ?x0 .
M4 ns:film.film.written_by ?x2 .
M5 ns:film.film.executive_produced_by ?x0 .
M5 ns:film.film.written_by ?x2
}