#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
ostream &operator<<(ostream &out, pair<T, U> pr) {
  out << pr.first << " " << pr.second;
  return out;
}
long long sq(int x) { return (long long)x * (long long)x; }
long long sqnorm(pair<int, int> p) { return sq(p.first) + sq(p.second); }
map<long long, set<pair<int, int>> *> classes;
set<pair<int, int>> *get_class(long long norm) {
  auto it = classes.find(norm);
  if (it == classes.end()) {
    classes[norm] = new set<pair<int, int>>;
    return classes[norm];
  }
  return it->second;
}
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
map<pair<int, int>, int> decr;
pair<int, int> avg(pair<int, int> p, pair<int, int> q) {
  p.first += q.first;
  p.second += q.second;
  int gc = gcd(p.first, p.second);
  p.first /= gc;
  p.second /= gc;
  return p;
}
int cnt = 0;
void add(pair<int, int> p) {
  set<pair<int, int>> *cur_class = get_class(sqnorm(p));
  if (decr.count(avg(p, p)) != 0) {
    decr[avg(p, p)] += 1;
  }
  for (set<pair<int, int>>::iterator it = cur_class->begin();
       it != cur_class->end(); it++) {
    pair<int, int> cur_avg = avg(*it, p);
    if (decr.count(cur_avg) != 0) {
      decr[cur_avg] += 2;
    }
  }
  cur_class->insert(p);
  cnt++;
}
void del(pair<int, int> p) {
  set<pair<int, int>> *cur_class = get_class(sqnorm(p));
  cur_class->erase(p);
  cnt--;
  for (set<pair<int, int>>::iterator it = cur_class->begin();
       it != cur_class->end(); it++) {
    pair<int, int> cur_avg = avg(*it, p);
    if (decr.count(cur_avg) != 0) {
      decr[cur_avg] -= 2;
    }
  }
  if (decr.count(avg(p, p)) != 0) {
    decr[avg(p, p)] -= 1;
  }
}
void answer(pair<int, int> p) {
  p = avg(p, p);
  cout << cnt - decr[p] << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  int queryc;
  cin >> queryc;
  vector<pair<int, pair<int, int>>> queries(queryc);
  for (int i = 0; i < queryc; i++) {
    cin >> queries[i].first >> queries[i].second.first >>
        queries[i].second.second;
    if (queries[i].first == 3) {
      decr[avg(queries[i].second, queries[i].second)] = 0;
    }
  }
  for (pair<int, pair<int, int>> query : queries) {
    if (query.first == 1) {
      add(query.second);
    } else if (query.first == 2) {
      del(query.second);
    } else {
      answer(query.second);
    }
  }
}
