#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000")
using namespace std;
const double PI = acos(-1.0);
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const long long BIGINF = 1e18;
mt19937 rnd(time(0));
uniform_int_distribution<int> uid(0, INF / 2);
vector<vector<int> > g;
vector<int> used;
int t1 = 0, t2 = 0;
void dfs(int i, int col) {
  used[i] = col;
  t1 += (col == 1), t2 += (col == 2);
  for (auto& j : g[i]) {
    if (!used[j]) dfs(j, 3 - col);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, a, b;
  cin >> n;
  g.resize(n);
  used.resize(n);
  for (int i = 0; i < n - 1; ++i) {
    cin >> a >> b;
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dfs(0, 1);
  cout << min(t1, t2) - 1 << '\n';
  return 0;
}
