SRM 329 DIV 2 easy & mid

read spec carefully...