#include <bits/stdc++.h>
using namespace std;
const int _ = 2200;
struct Po {
  long double x, y;
  Po(long double a = 0, long double b = 0) : x(a), y(b) {}
  Po operator-(Po p) const { return Po(x - p.x, y - p.y); }
  long double operator^(Po p) const { return x * p.y - y * p.x; }
} p[_];
int n;
const long double eps = 1e-14;
Po sta[_];
int top;
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 1; i <= n; i++) {
      double a, b, c;
      scanf("%lf %lf %lf", &a, &b, &c);
      p[i].x = a * c / (a * a + b * b);
      p[i].y = b * c / (a * a + b * b);
    }
    long long num = 0;
    for (int i = 1; i <= n; i++) {
      top = 0;
      for (int j = i + 1; j <= n; j++) {
        top++;
        sta[top].x = p[j].x - p[i].x;
        sta[top].y = p[j].y - p[i].y;
      }
      for (int j = 1; j <= top; j++)
        for (int k = j + 1; k <= top; k++)
          if (fabs(sta[j].x * sta[k].y - sta[j].y * sta[k].x) < eps) num++;
    }
    printf("%I64d", num);
  }
}
