#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const long double pi = 3.141592653589793238462643383279;
const long double log23 = 1.58496250072115618145373894394781;
const long double eps = 1e-8;
const long long INF = 1e18 + 239;
const long long prost = 239;
const int two = 2;
const int th = 3;
const long long MOD = 1e9 + 7;
const long long MOD2 = MOD * MOD;
const int BIG = 1e9 + 239;
const int alf = 26;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, 1, 0, -1};
const int dxo[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dyo[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
const int dig = 10;
const string str_alf = "abcdefghijklmnopqrstuvwxyz";
const string str_alf_big = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int digarr[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
const int bt = 31;
template <typename T>
inline T gcd(T a, T b) {
  return a ? gcd(b % a, a) : b;
}
template <typename T>
inline T lcm(T a, T b) {
  return (a / __gcd(a, b)) * b;
}
inline bool is_down(char x) { return ('a' <= x && x <= 'z'); }
inline bool is_upper(char x) { return ('A' <= x && x <= 'Z'); }
inline bool is_digit(char x) { return ('0' <= x && x <= '9'); }
inline int power(long long a, int b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return res;
}
mt19937 rnd(239);
const int M = 2 * 1e5 + 239;
const int N = 2 * 1e3 + 239;
const int L = 20;
const int T = (1 << 20);
const int B = trunc(sqrt(M)) + 1;
const int X = 150;
inline int gtgcd(int a, int b) {
  while (a) {
    b %= a;
    swap(a, b);
  }
  return b;
}
map<long long, set<pair<int, int> > > v;
unordered_map<long long, int> kol;
unordered_map<long long, int> kolh;
int g;
pair<int, int> b;
void addb() {
  int x = b.first;
  int y = b.second;
  int g = gtgcd(x, y);
  x /= g;
  y /= g;
  long long nw = ((long long)(x) << 30LL) + (long long)y;
  kolh[nw]++;
}
void delb() {
  int x = b.first;
  int y = b.second;
  int g = gtgcd(x, y);
  x /= g;
  y /= g;
  long long nw = ((long long)(x) << 30LL) + (long long)y;
  kolh[nw]--;
}
inline void add(pair<int, int> a) {
  a.first += b.first;
  a.second += b.second;
  g = gtgcd(a.first, a.second);
  a.first /= g;
  a.second /= g;
  long long nw = ((long long)(a.first) << 30LL) + (long long)a.second;
  kol[nw]++;
}
inline void del(pair<int, int> a) {
  a.first += b.first;
  a.second += b.second;
  g = gtgcd(a.first, a.second);
  a.first /= g;
  a.second /= g;
  long long nw = ((long long)(a.first) << 30LL) + (long long)a.second;
  kol[nw]--;
}
int main() {
  ios_base::sync_with_stdio(0);
  int q;
  cin >> q;
  int sum = 0;
  for (int z = 0; z < q; z++) {
    int t, x, y;
    cin >> t >> x >> y;
    b = make_pair(x, y);
    if (t == 1) {
      long long nw = (long long)x * (long long)x + (long long)y * (long long)y;
      for (pair<int, int> t : v[nw]) add(t);
      addb();
      v[nw].insert(b);
      sum++;
    } else if (t == 2) {
      long long nw = (long long)x * (long long)x + (long long)y * (long long)y;
      v[nw].erase(b);
      for (pair<int, int> t : v[nw]) del(t);
      delb();
      sum--;
    } else {
      g = gtgcd(x, y);
      x /= g, y /= g;
      long long h = ((long long)(x) << 30LL) + (long long)y;
      cout << (sum - 2 * kol[h] - kolh[h]) << "\n";
    }
  }
  return 0;
}
