#include<iostream>
#include<algorithm>
using namespace std;
const int N=1e5+10;
int x[N],y[N];
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++) cin>>x[i]>>y[i];
    int ans=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            double res=abs((double)y[i]-y[j])/abs((double)x[i]-x[j]);
            if(res>=-1 && res<=1) ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}
#include <bits/stdc++.h>

#define fileio                                                  \
    freopen("C:\\Users\\PRISM17\\Desktop\\in.txt", "r", stdin); \
    freopen("C:\\Users\\PRISM17\\Desktop\\out.txt", "w", stdout);
#define fastio                   \
    ios::sync_with_stdio(false); \
    cin.tie(0);                  \
    cout.tie(0);
#define dbg(x) cout << #x << " : " << x << endl;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const int inf = 0x3f3f3f3f;
const int INF = 1e9;
const int mod = 1e9 + 7;

const int N = 4e5 + 7;
int fa[N], vis[N];
int find(int x) {
    return fa[x] == x ? x : fa[x] = find(fa[x]);
}

int main() {
    int n; cin >> n;
    int ans = 0;
    for (int i = 1; i < N; i++) fa[i] = i;
    for (int i = 1, u, v; i <= n; i++) {
        cin >> u >> v;
        u = find(u), v = find(v);
        if (u != v && (!vis[u] || !vis[v])) fa[u] = v, vis[v] |= vis[u], ++ans;
        else if (!vis[u]) ++ans, vis[u] = 1;
    }
    cout << ans << endl;
}