Solution by Mark Senn
