Old problem
Straitforward solution (inefficient) for http://www.spoj.com/problems/MISERMAN/