Counting Pairs

You are given an array of $N$ integers. Count the number of pairs whose sum is divisible by $5$ in the given array.


This is a companion discussion topic for the original entry at https://toph.co/p/counting-pairs