#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
unordered_map<long long, int> h;
map<pair<int, int>, int> ans;
vector<pair<int, int> > a[N];
int num;
inline int get(long long r) {
  if (h.count(r)) return h[r];
  return h[r] = ++num;
}
inline pair<int, int> frac(int x, int y) {
  int z = gcd(x, y);
  return make_pair(x / z, y / z);
}
int n, Q, cnt;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  while (n--) {
    int x, y, opt;
    cin >> opt >> x >> y;
    long long r = 1ll * x * x + 1ll * y * y;
    int id = get(r);
    if (opt == 1) {
      cnt++;
      for (int i = 0; i < a[id].size(); i++) {
        pair<int, int> v = a[id][i];
        ans[frac(v.first + x, v.second + y)] += 2;
      }
      ans[frac(x, y)]++;
      a[id].push_back(make_pair(x, y));
    } else if (opt == 2) {
      cnt--;
      for (int i = 0; i < a[id].size(); i++) {
        pair<int, int> v = a[id][i];
        if (v.first == x && v.second == y) continue;
        ans[frac(v.first + x, v.second + y)] -= 2;
      }
      vector<pair<int, int> >::iterator it = a[id].begin();
      for (; it != a[id].end(); it++)
        if (*it == make_pair(x, y)) break;
      a[id].erase(it);
      ans[frac(x, y)]--;
    } else if (opt == 3) {
      cout << cnt - ans[frac(x, y)] << endl;
    }
  }
  return 0;
}
