Consider the set of remainders of the partial sums a(1) + ... + a(i). Since there are n such sums, either one has remainder zero (and we're thru) or 2 coincide, say the i'th and j'th. In this case, a(i+1) + ... + a(j) is divisible by n. (note this is a stronger result since the subsequence constructed is of adjacent terms.) Consider a(1) (mod n), a(1)+a(2) (mod n), ..., a(1)+...+a(n) (mod n). Either at some point we have a(1)+...+a(m) = 0 (mod n) or else by the pigeonhole principle some value (mod n) will have been duplicated. We win either way.

lib/config.php:156: Notice: Undefined variable: accept

lib/DbaDatabase.php:134: Warning: dba_replace() [<a href='function.dba-replace'>function.dba-replace</a>]: You cannot perform a modification to a database without proper access