add igor_kolupaev's third solution