CodeLab Academy 📞 9936 6696
← List Python · Level 8: Nested loops Code · 80 points ← #778 #780 →

#779. Pairs with a sum divisible by 3

Count the pairs with i < j where a[i] + a[j] is divisible by 3. ### Input The first line has n, the second line has n integers separated by spaces. ### Output A number.

Examples

Input
7
12 28 31 40 30 10 21
Output
3
Input
11
32 31 23 35 42 32 24 46 24 24 9
Output
18

💡 You can solve it with Python, JavaScript or blocks. Read the input line by line with input(). Don't print a question (like input("Number: ")). Print exactly what the output asks for, nothing more.

🔒 You can solve the first 3 problems without an account. Sign up for free to solve this one!