Solution by Daniel Mantovani
