#include <bits/stdc++.h>
using namespace std;
int const MAX = 2e5 + 41;
int const ADD = 1;
int const DEL = 2;
int const ASK = 3;
int gcd(int a, int b) { return (a ? gcd(b % a, a) : b); }
struct Point {
  int x, y;
  Point(){};
  Point(int x, int y) : x(x), y(y){};
  bool operator<(const Point &a) const {
    if (x != a.x) return x < a.x;
    return y < a.y;
  };
  bool operator==(const Point &a) const { return (x == a.x && y == a.y); };
  long long distance() { return (long long)x * x + (long long)y * y; }
  Point normalize() { return Point(x / gcd(x, y), y / gcd(x, y)); }
  Point getsym(Point a) { return Point(x + a.x, y + a.y).normalize(); }
};
Point p[MAX];
int type[MAX];
int q;
int dt[MAX];
long long const MAGIC = 2e5 + 41;
struct Hash {
  long long operator()(const Point &a) const { return a.x * MAGIC + a.y; };
};
vector<Point> vp[MAX];
unordered_map<Point, int, Hash> tdir;
map<Point, int> tsym;
void pushpoint(Point p, vector<Point> &vp) {
  vp.push_back(p);
  tdir[p.normalize()]++;
  for (int i = 0; i <= (int)vp.size() - 2; i++) {
    Point ps = p.getsym(vp[i]);
    tsym[ps.normalize()] += 2;
  }
}
void poppoint(Point p, vector<Point> &vp) {
  tdir[p.normalize()]--;
  bool f = false;
  for (int i = 0; i <= (int)vp.size() - 1; i++) {
    if (vp[i] == p) {
      swap(vp[i], vp[(int)vp.size() - 1]);
      f = 1;
      break;
    }
  }
  assert(f);
  for (int i = 0; i <= (int)vp.size() - 2; i++) {
    Point ps = p.getsym(vp[i]);
    tsym[ps.normalize()] -= 2;
  }
  vp.pop_back();
}
void solve() {
  vector<long long> v;
  for (int i = 1; i <= q; i++) {
    v.push_back(p[i].distance());
  }
  sort(v.begin(), v.end());
  v.resize(unique(v.begin(), v.end()) - v.begin());
  for (int i = 1; i <= q; i++) {
    dt[i] = (int)(lower_bound(v.begin(), v.end(), p[i].distance()) - v.begin());
  }
  int cnt = 0;
  for (int i = 1; i <= q; i++) {
    if (type[i] == ADD) {
      pushpoint(p[i], vp[dt[i]]);
      cnt++;
    } else if (type[i] == DEL) {
      poppoint(p[i], vp[dt[i]]);
      cnt--;
    } else {
      int res = cnt;
      res -= tdir[p[i].normalize()];
      res -= tsym[p[i].normalize()];
      printf("%d\n", res);
    }
  }
}
int main() {
  scanf("%d", &q);
  for (int i = 1; i <= q; i++) {
    scanf("%d %d %d", &type[i], &p[i].x, &p[i].y);
  }
  solve();
  return 0;
}
