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

#758. Triples with sum 0

Count the triples with i < j < l and a[i] + a[j] + a[l] = 0. ### Input The first line has n, the second line has n integers separated by spaces. ### Output A number.

Examples

Input
11
2 5 -1 -5 -4 1 1 3 -3 3 -3
Output
11
Input
9
-3 2 -2 3 4 1 3 5 3
Output
2

💡 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!