#include <bits/stdc++.h>
using namespace std;
void boost() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
int n, vis[200005], level[200005];
vector<vector<int>> vec(200005);
void dfs(int i, int col) {
  vis[i] = 1;
  level[i] = col;
  for (auto it : vec[i]) {
    if (vis[it]) continue;
    dfs(it, 2 - col + 1);
  }
}
int main() {
  boost();
  int ans, cnt = 0, i, j, m, a, b;
  cin >> n;
  for (i = 0; i < n - 1; i++) {
    cin >> a >> b;
    vec[a].push_back(b);
    vec[b].push_back(a);
  }
  memset(vis, 0, sizeof(vis));
  dfs(1, 1);
  for (i = 1; i < n + 1; i++)
    if (level[i] == 1) cnt++;
  ans = min(cnt, n - cnt) - 1;
  cout << ans;
}
