#include using namespace std; using ll = long long; int main() { std::ios::sync_with_stdio(false); ll N; cin >> N; unordered_set x; unordered_set y; ll count = 0; ll x_0, y_0; cin >> x_0 >> y_0; x.insert(x_0); y.insert(y_0); for (int i = 1; i < N; i++) { ll x_0, y_0; cin >> x_0 >> y_0; if (x.find(x_0) == x.end() && y.find(y_0) == y.end()) { count++; } x.insert(x_0); y.insert(y_0); } cout << count << endl; }