#include <bits/stdc++.h>
using namespace std;
void DFSv(int v, int par, vector<vector<int> > &G,
          vector<vector<vector<int> > > &ans) {
  bool leaf = ((int)(G[v]).size() == 1);
  if (leaf) {
    ans[0][v] = vector<int>{1000000001, 0};
    ans[1][v] = vector<int>{0, 1000000001};
  } else {
    for (int u : G[v])
      if (u != par) {
        DFSv(u, v, G, ans);
        if (ans[0][v].empty()) {
          for (int i = (0); i <= (1); ++i)
            for (int x = (0); x <= ((int)(ans[i][u]).size() - 1); ++x)
              ans[i][v].push_back(min(ans[i][u][x], 1 + ans[!i][u][x]));
          continue;
        }
        int old[] = {(int)(ans[0][v]).size(), (int)(ans[1][v]).size()};
        int child[] = {(int)(ans[0][u]).size(), (int)(ans[1][u]).size()};
        vector<vector<int> > temp;
        for (int i = (0); i <= (1); ++i)
          temp.push_back(vector<int>(old[i] + child[i] - 1, 1000000001));
        for (int i = (0); i <= (1); ++i)
          for (int L = (0); L <= (old[i] - 1); ++L)
            for (int j = (0); j <= (1); ++j)
              for (int R = (0); R <= (child[j] - 1); ++R) {
                int here = ans[i][v][L] + ans[j][u][R] + (i != j);
                temp[i][L + R] = min(temp[i][L + R], here);
              }
        for (int i = (0); i <= (1); ++i) ans[i][v] = temp[i];
      }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<vector<int> > G(n);
  for (int i = (1); i <= (n - 1); ++i) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  if (n == 2) {
    cout << 1;
    return 0;
  }
  vector<vector<vector<int> > > ans(2, vector<vector<int> >(n));
  int root = 0;
  while ((int)(G[root]).size() == 1) root++;
  DFSv(root, -1, G, ans);
  int leafs = 0;
  for (int i = (0); i <= ((int)(G).size() - 1); ++i)
    if ((int)(G[i]).size() == 1) leafs++;
  int best = 1000000001;
  for (int i = (0); i <= (1); ++i) best = min(best, ans[i][root][leafs / 2]);
  cout << best;
  return 0;
}
