#include <bits/stdc++.h>
using namespace std;
const int mxi = 4e5 + 666;
const long long mod = 1e9 + 7;
const long long inf = 1e18;
const int llg = 18;
long long q, n, p[mxi];
map<long long, long long> g, cnt;
map<long long, set<pair<long long, long long>>> m;
set<pair<long long, long long>>::iterator it;
long long powe(long long a, long long b) {
  if (!b) return 1;
  long long c = powe(a, b / 2);
  if (b % 2 == 0)
    return c * c % mod;
  else
    return c * c % mod * a % mod;
}
void add(long long x, long long y) {
  long long z = x * x + y * y;
  n++;
  g[y * p[x] % mod]++;
  for (it = m[z].begin(); it != m[z].end(); it++)
    cnt[(y + it->second) * p[x + it->first] % mod]++;
  m[z].insert({x, y});
}
void del(long long x, long long y) {
  long long z = x * x + y * y;
  n--;
  g[y * p[x] % mod]--;
  m[z].erase({x, y});
  for (it = m[z].begin(); it != m[z].end(); it++)
    cnt[(y + it->second) * p[x + it->first] % mod]--;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  for (int i = 1; i < mxi; i++) {
    p[i] = powe(i, mod - 2);
  }
  cin >> q;
  while (q--) {
    long long t, x, y;
    cin >> t >> x >> y;
    if (t == 1) {
      add(x, y);
    } else if (t == 2) {
      del(x, y);
    } else {
      cout << n - cnt[y * p[x] % mod] * 2 - g[y * p[x] % mod] << '\n';
    }
  }
}
