#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using vi = vector<int>;
const int inf = 1e9, maxn = 2e5;
int DFS(vector<int> g[], int v, int p, int c) {
  int res = c;
  for (int u : g[v])
    if (u != p) res += DFS(g, u, v, c ^ 1);
  return res;
}
void solve() {
  int n;
  cin >> n;
  vector<int> g[n];
  for (int i = 0; i < n - 1; i++) {
    int u;
    cin >> u;
    int v;
    cin >> v;
    v--, u--;
    g[u].push_back(v), g[v].push_back(u);
  }
  int am = DFS(g, 0, -1, 0);
  cout << min(am, n - am) - 1;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t = 1;
  for (int i = 0; i < t; i++) solve();
}
