#include <bits/stdc++.h>
using namespace std;
vector<int>adj[100007];
int cnt[100007];
int main()
{
    int m=-1;
    int n;
    cin>>n;
    for(int i=1;i<n;++i)
    {
        int u,v;
        cin>>u>>v;
        adj[u].push_back(v);
        adj[v].push_back(u);
        ++cnt[u];
        m=max(m,cnt[u]);
        ++cnt[v];
        m=max(m,cnt[v]);
    }
    int d=n/2+n%2-1;
    int k=d%m;
    d=d/m;
    d=d*2;
    if(k>1)d=d+2;
    if(d==0)cout<<1;
    cout<<d;




}