Simple, although correct, Python solution.