#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> graph[100010];
bool visited[100010];
int res = 100010;
int dfs(int x)
{
if (visited[x])
return 0;
visited[x] = 1;
int cnt = 1;
int h = 0;
for (int &v : graph[x])
{
int tmp = dfs(v);
cnt += tmp;
h = max(h, tmp);
}
h = max(h, N - cnt);
res = min(res, h);
return cnt;
}
int main(void)
{
cin >> N;
int x, y;
for (int i = 0; i < N - 1; i++)
{
cin >> x >> y;
graph[x].push_back(y);
graph[y].push_back(x);
}
dfs(1);
cout << res;
return 0;
}