#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int w = 0, f = 1;
  char c;
  while (!isdigit(c = getchar())) c == '-' && (f = -1);
  while (isdigit(c)) w = w * 10 + (c ^ 48), c = getchar();
  return w * f;
}
int q, cnt, idx;
bool del[500005];
vector<pair<int, int> > a[500005];
map<long long, int> Map;
map<pair<int, int>, int> ans;
int ID(long long r) {
  if (Map.count(r)) return Map[r];
  return Map[r] = ++idx;
}
int gcd(int x, int y) { return !y ? x : gcd(y, x % y); }
pair<int, int> frac(pair<int, int> x) {
  int z = gcd(x.first, x.second);
  return pair<int, int>(x.first / z, x.second / z);
}
int main() {
  int i, op, x, y;
  q = read();
  while (q--) {
    op = read(), x = read(), y = read();
    long long r = x * x + y * y, id = ID(r);
    if (op == 1) {
      cnt++;
      for (i = 0; i < a[id].size(); i++)
        ans[frac({a[id][i].first + x, a[id][i].second + y})] += 2;
      ans[frac({x, y})]++;
      a[id].push_back(pair<int, int>(x, y));
    }
    if (op == 2) {
      cnt--;
      pair<int, int> t = frac({x, y});
      for (i = 0; i < a[id].size(); i++)
        if (a[id][i] != make_pair(x, y))
          ans[frac({a[id][i].first + x, a[id][i].second + y})] -= 2;
      vector<pair<int, int> >::iterator it = a[id].begin();
      while (*it != make_pair(x, y)) it++;
      a[id].erase(it);
      ans[t]--;
    }
    if (op == 3) printf("%d\n", cnt - ans[frac({x * 2, y * 2})]);
  }
  return 0;
}
