#include <bits/stdc++.h>
int main(void) {
  int num;
  scanf("%d", &num);
  int vc[num];
  int count2;
  for (count2 = 0; count2 < num; count2++) {
    scanf("%d", &vc[count2]);
  }
  putchar('\n');
  int count3, count4, count5;
  int d1, d2, d3;
  int sum;
  int counts = 0;
  for (count3 = 0; count3 <= num - 3; count3++) {
    d1 = vc[count3];
    for (count4 = count3 + 1; count4 <= num - 2; count4++) {
      d2 = vc[count4];
      for (count5 = count4 + 1; count3 <= num - 1; count5++) {
        d3 = vc[count5];
        sum = d1 + d2 + d3;
        if (sum == 0) counts++;
      }
    }
  }
  printf("%d", counts);
  return 0;
}
