#include <bits/stdc++.h>
using namespace std;
int n;
map<int, set<pair<int, int>>> M;
map<pair<int, int>, int> cnt;
int main() {
  scanf("%d", &n);
  int total = 0;
  auto gcd = [&](int x, int y) {
    while (y) {
      swap(x, y);
      y %= x;
    }
    return x;
  };
  auto dw = [&](int x, int y) {
    int g = gcd(x, y);
    x /= g;
    y /= g;
    return pair<int, int>{x, y};
  };
  for (int i = 1; i <= n; i++) {
    int c, x, y;
    scanf("%d %d %d", &c, &x, &y);
    if (c < 3) {
      long long d = (long long)x * x + (long long)y * y;
      if (c == 2) {
        c = -1;
        M[d].erase({x, y});
      }
      total += c;
      for (auto p : M[d]) cnt[dw(x + p.first, y + p.second)] += 2 * c;
      cnt[dw(x, y)] += c;
      if (c == 1) {
        M[d].insert({x, y});
      }
    } else {
      printf("%d\n", total - cnt[dw(x, y)]);
    }
  }
  return 0;
}
