St Andrews Online Judge

Triplets Divisible by 5

By Kay Akashi

Time: 1000 ms
Memory: 256000 kB

The code judging system is only available during contests. Check out the github repo for test cases and solutions.

Please log in.

Problem Statement

You are given a list of non-negative numbers, a1,a2,a3,...,ana_1, a_2, a_3, ..., a_n. You want to choose ii, jj, kk (1i<j<kn)(1 \leq i \lt j \lt k \leq n) in such a way that ai+aj+aka_i + a_j + a_k is divisible by 55. How many possible pairs of (i,j,k)(i, j, k) are there in total?

In the first example, (1,2,3)(1, 2, 3) is the only set of indices that satisfies the condition. Hence the answer is 11.

In the second example, (1,2,3)(1, 2, 3), (1,2,4)(1, 2, 4), (1,3,5)(1, 3, 5), and (1,4,5)(1, 4, 5) satisfy the condition. Hence the answer is 44.

Constraints

3n1053 \leq n \leq 10^{5}, 0ai1050 \leq a_i \leq 10^{5} (1in)(1 \leq i \leq n).

Subtask 1 (20%)

3n<1003 \leq n \lt 100.

Subtask 2 (80%)

100n105100 \leq n \leq 10^{5}.

Input

The first line contains one number nn, the length of aa. Following is the sequence of nn numbers, separated by single spaces, that compose aa.

Output

Output the answer.

Examples

Input

3
0 5 10

Output

1

Input

5
2 3 0 10 8

Output

4