#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200000;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
pair<int, int> reduce(pair<int, int> p) {
  int first = p.first, second = p.second;
  int g = gcd(first, second);
  first /= g;
  second /= g;
  if (first < 0) {
    first = -first;
    second = -second;
  }
  return {first, second};
}
pair<int, int> to_vec(pair<int, int> a, pair<int, int> b) {
  return {b.first - a.first, b.second - a.second};
}
int cur;
map<long long, int> idx;
vector<pair<int, int> > ps[MAXN + 5];
map<pair<int, int>, int> cnt, one;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int Q, all = 0;
  cin >> Q;
  for (int q = 0; q < Q; q++) {
    int t;
    long long first, second, d;
    cin >> t >> first >> second;
    d = first * first + second * second;
    pair<int, int> p = {first, second};
    if (t == 1) {
      auto it = idx.find(d);
      int id;
      if (it == idx.end()) {
        id = ++cur;
        idx.emplace(d, cur);
      } else {
        id = it->second;
      }
      all++;
      for (auto &p2 : ps[id]) {
        pair<int, int> v = to_vec(p, p2), normal = reduce({-v.second, v.first});
        cnt[normal]++;
      }
      one[reduce(p)]++;
      ps[id].push_back(pair<int, int>(first, second));
    } else if (t == 2) {
      int id = idx[d];
      assert(id != 0);
      int pos = -1;
      all--;
      for (int i = 0; i < ps[id].size(); i++) {
        auto &p2 = ps[id][i];
        if (p2 == p) {
          pos = i;
          continue;
        }
        pair<int, int> v = to_vec(p, p2), normal = reduce({-v.second, v.first});
        cnt[normal]--;
      }
      assert(pos != -1);
      one[reduce(p)]--;
      swap(ps[id][pos], ps[id].back());
      ps[id].pop_back();
    } else {
      p = reduce(p);
      cout << all - 2 * cnt[p] - one[p] << '\n';
    }
  }
}
