#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
#define rep(i,n) for(ll i=0;i<(n);++i)
#define rep2(i,n) for(ll i=1;i<=(n);++i)
#define rep3(i,i0,n) for(ll i=i0;i<(n);++i)
#define rrep(i,n) for(ll i=((n)-1); i>=0; --i)
#define rrep2(i,n) for(ll i=(n); i>0; --i)
#define pb push_back
#define mod 1000000007
#define fi first
#define se second
#define len(x) ((ll)(x).size())
using namespace std;
using ll = long long;
using ld = long double;
using Pi = pair< ll, ll >;
using vl = vector<ll>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vp = vector<Pi>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

const ll INF = 1LL << 60;
const ld PI = 3.1415926535897932385;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define mp make_pair
void printb(ll N,ll d=16){
    rep(i,d){
        cout<<(N/(1<<(d-i-1)))%2;
    }
    cout<<endl;
    
}
void printv(vector<ll>a){
    rep(i,a.size()){
        if(i==a.size()-1){
            cout<<a[i]<<endl;
        }else{
            cout<<a[i]<<" ";
        }
    }
}
bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


//const vector<ll> dx = {1, 0, -1, 0, 1, -1, 1, -1};
//const vector<ll> dy = {0, 1, 0, -1, 1, 1, -1, -1};
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll K;
    cin>>K;

    vl AB(K+1);

    rep2(i,K){
        ll now=i;
        while(1){
            if(now>K)break;
            AB[now]++;
            now+=i;
        }
        //AB[K/i]++;
    }
    //printv(AB);
    //reverse(all(AB));
    rep(i,K){
        
        AB[i+1]+=AB[i];
    }
    //printv(AB);
    ll ans=0;
    rep2(i,K){
        ll now=1;
        ll cnt=1;
        
        ans+=AB[K/i];
    }

    cout<<ans<<endl;

    //printv(AB);
    return 0;
    

}
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;

const int INF = (1<<30)-1;
const ll LINF = 1e18;

#define rep(i, n) for (int i = 0; i < n; i++)

template<class T> 
bool chmax(T &a, T b) {if (a < b) {a = b;return true;}else return false;}

template<class T> 
bool chmin(T &a, T b) {if (a > b) {a = b;return true;}else return false;}

class union_find {
    vector<long long> par, sz, h;
    long long g;    //連結成分数

public:
     union_find(long long n) {
        par.resize(n);
        h.resize(n, 0);
        sz.resize(n,1);
        g = n;
        for (long long i = 0; i < n; i++)
            par[i] = i;
    }

    long long find(long long x) {
        if (par[x] == x)
            return x;
        else 
            return par[x] = find(par[x]);
    }

    void unite(long long x, long long y) {
        x = find(x), y = find(y);
        if (x == y)
            return ;
        
        g--;
        if (h[x] < h[y])
            swap(x, y);
        
        sz[x] += sz[y];
        sz[y] = sz[x];
        par[y] = x;
        if (h[x] == h[y])
            h[x]++;
    }

    bool same(long long x, long long y) {
        return find(x) == find(y);
    }
    
    int size(long long x) {
        return sz[x] = sz[find(x)];
    }

    long long groups() {
        return g;
    }
};

int main() {
    int n;  cin >> n;
    vector<ll> a(n), b(n), vals;    
    rep(i, n){
        cin >> a[i] >> b[i];
        vals.push_back(a[i]);
        vals.push_back(b[i]);
    }
    sort(vals.begin(), vals.end());
    vals.erase(unique(vals.begin(), vals.end()), vals.end());
    rep(i, n) {
        a[i] = lower_bound(vals.begin(), vals.end(), a[i]) - vals.begin();
        b[i] = lower_bound(vals.begin(), vals.end(), b[i]) - vals.begin();
    }
    union_find uf(vals.size());
    vector<int> cnt(vals.size(), 0);
    rep(i, n) {
        int x = uf.find(a[i]), y = uf.find(b[i]);
        if (x == y) {
            cnt[x]++;
            continue;
        }
        uf.unite(x, y);
        if (x != uf.find(x))
            swap(x, y);
        
        cnt[x] += 1 + cnt[y];
    }
    vector<bool> flag(vals.size(), false);
    ll ans = 0;
    rep(i, vals.size()) {
        if (flag[uf.find(i)])    continue;
        ans += min(uf.size(i), cnt[uf.find(i)]);
        flag[uf.find(i)] = true;
    }
    cout << ans << endl;
    return 0;
}