Is it divisible?

0

0 votes
Easy, Simple-math
Problem

Question is pretty straight-forward.

You are given a set of 'n' numbers. You need to find total pairs of numbers whose sum is divisible by 5.

Note: Pair of numbers means collection of any two numbers from the set.

See sample test-case for more understanding.


Input format:

First line consist of total numbers given as 'n'.

Next Line consists of 'n' numbers seperated by space.


Output format:

Output total pairs whose sum is divisible by 5.


Constraints:

1 <= n <= 10^6

1 <= number <= 10^6

Sample Input
3
1 2 3
Sample Output
1
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Total pairs possible in this test-case are: (1, 2), (1, 3) and (2, 3).

(1, 2) --> 1 + 2 == 3 (not divisible by 5)

(1, 3) --> 1 + 3 == 4 (not divisible by 5)

(2, 3) --> 2 + 3 == 5 (divisible by 5)

Hence, answer is 1 as only one pair has a sum divisible by 5.

Editor Image

?