#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long qpow(long long x, long long k) {
  return k == 0 ? 1
                : 1ll * qpow(1ll * x * x % mod, k >> 1) * (k & 1 ? x : 1) % mod;
}
class pnt {
 public:
  int x, y;
  pnt(int X, int Y) {
    x = X;
    y = Y;
  }
  bool operator<(const pnt& o) const { return x < o.x; }
  pnt operator+(pnt& o) { return pnt(x + o.x, y + o.y); }
  double ang() { return atan2(y, x); }
};
long long dis(pnt a) { return (long long)a.x * a.x + (long long)a.y * a.y; }
int q;
map<long long, set<pnt>> mp;
map<double, int> cnt;
int num = 0;
void update(int t, pnt a) {
  long long d = dis(a);
  if (t == 1) {
    for (auto p : mp[d]) {
      pnt ax = p + a;
      double ang = ax.ang();
      cnt[ang] += 2;
    }
    double ang = a.ang();
    cnt[ang]++;
    mp[d].insert(a);
    num++;
  } else {
    mp[d].erase(a);
    for (auto p : mp[d]) {
      pnt ax = p + a;
      double ang = ax.ang();
      cnt[ang] -= 2;
    }
    double ang = a.ang();
    cnt[ang]--;
    num--;
  }
}
int main() {
  scanf("%d", &q);
  for (int i = 1; i <= q; i++) {
    int t, x, y;
    scanf("%d%d%d", &t, &x, &y);
    if (t == 3) {
      double ang = pnt(x, y).ang();
      printf("%d\n", num - cnt[ang]);
    } else {
      update(t, pnt(x, y));
    }
  }
  return 0;
}
