#include <bits/stdc++.h>
struct Point {
  int x, y;
  Point* next;
  bool operator<(const Point& p) const { return 1ll * p.x * y < 1ll * x * p.y; }
} P[200010], *np = P;
std::map<long long, Point*> fir;
std::map<Point, int> M;
int main() {
  int q, s = 0;
  scanf("%d", &q);
  while (q--) {
    int t, x, y;
    scanf("%d%d%d", &t, &x, &y);
    long long d = 1ll * x * x + 1ll * y * y;
    if (t == 1) {
      M[(Point){x, y}]++;
      for (Point* p = fir[d]; p; p = p->next)
        M[(Point){x + p->x, y + p->y}] += 2;
      *np = (Point){x, y, fir[d]};
      fir[d] = np++;
      s++;
    }
    if (t == 2) {
      M[(Point){x, y}]--;
      if (fir[d] && fir[d]->x == x && fir[d]->y == y) fir[d] = fir[d]->next;
      ;
      for (Point* p = fir[d]; p; p = p->next) {
        if (p->next && p->next->x == x && p->next->y == y)
          p->next = p->next->next;
        ;
        M[(Point){x + p->x, y + p->y}] -= 2;
      }
      s--;
    }
    if (t == 3) printf("%d\n", s - M[(Point){x, y}]);
  }
}
