#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const long long mod = 1e9 + 7;
const long long maxn = 4e5 + 10, maxt = 100 + 10;
long long q, n;
long long inv[maxn];
map<long long, long long> shib, cnt;
map<long long, set<pair<long long, long long>>> mp;
set<pair<long long, long long>>::iterator itr;
long long power(long long a, long long b) {
  if (!b) {
    return 1;
  }
  long long c = power(a, b / 2);
  if (b % 2) {
    return c * c % mod * a % mod;
  } else {
    return c * c % mod;
  }
}
void add(long long x, long long y) {
  long long tol = x * x + y * y;
  n++;
  shib[y * inv[x] % mod]++;
  for (itr = mp[tol].begin(); itr != mp[tol].end(); itr++) {
    cnt[(y + itr->second) * inv[x + itr->first] % mod]++;
  }
  mp[tol].insert({x, y});
}
void remove(long long x, long long y) {
  n--;
  long long tol = x * x + y * y;
  shib[y * inv[x] % mod]--;
  mp[tol].erase({x, y});
  for (itr = mp[tol].begin(); itr != mp[tol].end(); itr++) {
    cnt[(y + itr->second) * inv[x + itr->first] % mod]--;
  }
}
long long get(long long x, long long y) {
  return n - cnt[y * inv[x] % mod] * 2 - shib[y * inv[x] % mod];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  for (int i = 1; i < maxn; i++) {
    inv[i] = power(i, mod - 2);
  }
  cin >> q;
  while (q--) {
    long long tp, x, y;
    cin >> tp >> x >> y;
    if (tp == 1) {
      add(x, y);
    } else if (tp == 2) {
      remove(x, y);
    } else {
      cout << get(x, y) << endl;
    }
  }
}
