#include<bits/stdc++.h>
using namespace std;
int n;
const int N = 100005;
// 无向边
int ne[N * 2], e[N * 2], idx;
int h[N];
int vis[N];
int ans = 0x7fffffff;
void add(int a, int b) {
e[++idx] = b, ne[idx] = h[a], h[a] = idx;
}
int dfs(int u) { // 作为根节点
vis[u] = 1;
int size = 0;
int sum = 1;
for (int i = h[u]; i != -1; i = ne[i]) {
int j = e[i];
if (vis[j]) continue;
int s = dfs(j);
size = max(size, s);
sum += s;
}
ans = min(ans, max(n - sum, size));
return sum;
}
int main() {
memset(h, -1, sizeof h); // 相当于初始化为null
cin >> n;
for (int i = 1; i < n; i++) {
int a, b;
cin >> a >> b;
add(a, b), add(b, a);
}
dfs(1);
cout << ans;
return 0;
}