#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
const int N = 101000;
vector<pair<long long, long long> > v[N];
map<long long, int> hs;
int t, cnt, n, cur;
long long x, y;
struct Hash_table {
  static const int V = 10000019;
  int fst[V], nxt[V], T;
  bool vis[V];
  int val[V];
  pair<long long, long long> key[V];
  void add(pair<long long, long long> s, int v) {
    int S = (s.first * 13333331ll + s.second) % V;
    if (!vis[S]) vis[S] = 1, fst[S] = -1;
    for (int j = fst[S]; j != -1; j = nxt[j])
      if (key[j] == s) {
        val[j] += v;
        return;
      }
    nxt[T] = fst[S], fst[S] = T, key[T] = s, val[T] = v;
    T++;
  }
  int query(pair<long long, long long> s) {
    int S = (s.first * 13333331ll + s.second) % V;
    if (!vis[S]) return 0;
    for (int j = fst[S]; j != -1; j = nxt[j])
      if (key[j] == s) return val[j];
    return 0;
  }
} ans;
pair<long long, long long> add(pair<long long, long long> a,
                               pair<long long, long long> b) {
  long long d1 = a.first * b.second + a.second * b.first;
  long long d2 = a.second * b.second - a.first * b.first;
  long long d = gcd(d1, d2);
  d1 /= d;
  d2 /= d;
  if (make_pair(d1, d2) < make_pair(0ll, 0ll)) d1 = -d1, d2 = -d2;
  return make_pair(d1, d2);
}
void add(int id, long long x, long long y) {
  cnt++;
  v[id].push_back(make_pair(x, y));
  for (auto p : v[id]) {
    ans.add(add(p, make_pair(x, y)), p == make_pair(x, y) ? 1 : 2);
  }
}
void del(int id, long long x, long long y) {
  cnt--;
  for (auto p : v[id]) {
    ans.add(add(p, make_pair(x, y)), p == make_pair(x, y) ? -1 : -2);
  }
  v[id].erase(find((v[id]).begin(), (v[id]).end(), make_pair(x, y)));
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%lld%lld", &t, &x, &y);
    if (t == 1) {
      if (!hs.count(x * x + y * y)) hs[x * x + y * y] = cur++;
      add(hs[x * x + y * y], x, y);
    } else if (t == 2) {
      del(hs[x * x + y * y], x, y);
    } else {
      printf("%d\n", cnt - ans.query(add(make_pair(x, y), make_pair(x, y))));
    }
  }
}
