http://www.spoj.com/problems/ARMY/