#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, M =  2 * N;
int h[N], e[M], ne[M], idx;
int ans = N , n;
bool st[N];
void add(int a, int b)
{
    e[idx] = b, ne[idx] = h[a], h[a] = idx ++;
    //e[idx]表示第idx个节点所指向的点是哪个
    //h[a]表示当前头节点是第几个节点
    //ne[idx]表示第idx个节点下一个节点是哪一个
}

int dfs(int u)
{
    st[u] = true;
    
    int sum = 1, res = 0;//res表示以当前点可以到达的节点中最大的连通块数量
    for(int i  = h[u]; i != -1; i = ne[i])
    {
        int j = e[i];
        if(!st[j])
        {
            int s = dfs(j);
            res = max(s, res);
            sum += s;
        }
    }
    res = max(res, n - sum);
    ans = min(res, ans);
    return sum;
}

int main()
{
    memset(h, -1, sizeof h);
    cin >> n;
    for(int i = 0; i < n - 1; i ++)
    {
        int a, b;
        cin >> a >> b;
        add(a, b), add(b, a);
    }
    dfs(1); 
    cout << ans  << endl;
}