#include <bits/stdc++.h>
bool isFile;
using namespace std;
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
void _();
void faster() {
  _();
  if (isFile) {
    freopen(
        "taskA"
        ".in",
        "r", stdin);
    freopen(
        "taskA"
        ".out",
        "w", stdout);
  }
  if (1) {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  }
}
const long long INF = 9e18;
const int inf = 2e9;
const int MOD = 998244353;
const long double PI = acos(-1);
const long double EPS = 1e-7;
const int N = (int)2e5 + 5;
const int M = 1234;
vector<int> g[N];
int dp[N];
void dfs(int v, int pr = -1, int lvl = 0) {
  dp[lvl % 2]++;
  for (int to : g[v])
    if (to != pr) dfs(to, v, lvl + 1);
}
void solve() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1);
  cout << min(dp[0], dp[1]) - 1 << endl;
}
void _() {}
int main() {
  faster();
  int t = 1;
  int id = 1;
  while (t--) {
    solve();
  }
  return 0;
}
