The Modulo 9 Mystery

1

1 votes
Problem

You have been given N natural numbers X1 , X2 , ... XN . Let us define Yi to be:

Yi = F(Xi) , where F(Xi) is calculated in the following recursive manner:

F(Xi) {
if (Xi == 0) return (0);
else return (F(Xi / 10) + Xi % 10);
}

You have to now find the value of:

(Y1 + Y2 + .... + YN) % 9 - (F(X1 + X2 + .... + XN)) % 9

Input

First line consist of N. The next N lines are such that the ith line consists of a single natural number Xi.

Output

Print a single line consisting of the computed value.

Constraints

2 <= N <= 10,000
1 <= Xi <= 1010,000

Time Limit: 2
Memory Limit: 256
Source Limit:
Editor Image

?