SRM 526 DIV 2 500

Quite Easy Brute Force