Add solution for #580 Critical Mass