#include <bits/stdc++.h>
using namespace std;
const int MAXN = (int)4e5 + 3;
const int MOD = (int)1e9 + 7;
const int infint = (int)1e8 + 3;
const long long inf = (long long)1e18;
int q;
long long INV[MAXN];
long long pwr(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1) return a % MOD;
  long long c = pwr(a, b / 2);
  c = (c * c) % MOD;
  if (b % 2) c = (c * a) % MOD;
  return c;
}
long long inv(long long a) { return pwr(a, MOD - 2); }
struct point {
  long long x, y;
  point(int a, int b) { x = a, y = b; }
};
unordered_map<long long, int> ang, online;
unordered_map<long long, vector<point> > M;
int all = 0;
inline void add(int x, int y) {
  all++;
  online[y * INV[x] % MOD]++;
  long long len = x * x + y * y;
  for (auto u : M[len]) ang[(x + u.x) * INV[y + u.y] % MOD]++;
  M[len].push_back(point(x, y));
}
inline void remove(int x, int y) {
  all--;
  online[y * INV[x] % MOD]--;
  long long len = x * x + y * y;
  vector<point> nw;
  for (auto u : M[len])
    if (u.x != x || u.y != y) nw.push_back(u);
  M[len].clear();
  for (auto u : nw) M[len].push_back(u);
  for (auto u : M[len]) ang[(x + u.x) * INV[y + u.y] % MOD]--;
}
int calc(int x, int y) {
  return all - ang[x * INV[y] % MOD] * 2 - online[y * INV[x] % MOD];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  for (int i = 1; i < MAXN; i++) INV[i] = inv(i);
  cin >> q;
  while (q--) {
    int type, x, y;
    cin >> type >> x >> y;
    if (type == 1)
      add(x, y);
    else if (type == 2)
      remove(x, y);
    else
      cout << calc(x, y) << "\n";
  }
}
