#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while (!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(vector<string> __attribute__((unused)) args,
               __attribute__((unused)) int idx,
               __attribute__((unused)) int LINE_NUM) {
  cerr << endl;
}
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if (idx > 0)
    cerr << ", ";
  else
    cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss;
  ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
long long binC(long long n, long long k) {
  long long C[k + 1];
  long long j;
  for (__typeof(k + 1) j = (0) - ((0) > (k + 1));
       j != (k + 1) - ((0) > (k + 1)); j += 1 - 2 * ((0) > (k + 1)))
    C[j] = 0;
  C[0] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = min(i, k); j > 0; j--) C[j] = C[j] + C[j - 1];
  }
  return C[k];
}
long long fact(long long n, long long a = 1) {
  long long i;
  for (__typeof(n + 1) i = (1) - ((1) > (n + 1));
       i != (n + 1) - ((1) > (n + 1)); i += 1 - 2 * ((1) > (n + 1)))
    a = (a * i) % MOD;
  return a;
}
vector<long long> primes;
bool pr[400005];
void sieve() {
  long long i, j;
  for (i = 0; i < 400005; i++) pr[i] = true;
  for (i = 2; i * i < 400005; i++)
    if (pr[i]) {
      primes.push_back(i);
      for (j = i * i; j < 400005; j += i) pr[j] = false;
    }
}
long long e_gcd(long long a, long long b, long long &x, long long &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long x1, y1;
  long long d = e_gcd(b, a % b, x1, y1);
  x = y1;
  y = x1 - y1 * (a / b);
  return d;
}
bool comp(pair<string, pair<int, char>> a, pair<string, pair<int, char>> b) {
  if (a.second.first > b.second.first) return false;
  if (a.second.second - 'a' > b.second.second - 'a') return false;
  return true;
}
void getd(string g, int &l, char &h) {
  vector<char> a = {'a', 'e', 'i', 'o', 'u'};
  for (int i = 0; i < g.length(); i++) {
    for (int j = 0; j < a.size(); j++) {
      if (g[i] == a[j]) {
        l++;
        h = a[j];
      }
    }
  }
}
int bfs(vector<int> gr[], int root, int n) {
  vector<bool> vis(n + 1, false);
  vector<int> color(n + 1, 0);
  queue<int> q;
  q.push(root);
  color[root] = 0;
  vis[root] = true;
  while (!q.empty()) {
    int t = q.front();
    q.pop();
    for (auto j : gr[t]) {
      if (!vis[j]) {
        vis[j] = true;
        color[j] = color[t] ^ 1;
        q.push(j);
      }
    }
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (color[i]) cnt++;
  }
  return min(cnt, n - cnt);
}
void solve() {
  long long n;
  cin >> n;
  vector<int> gr[n + 1];
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    gr[a].push_back(b);
    gr[b].push_back(a);
  }
  cout << bfs(gr, 1, n) - 1 << "\n";
  return;
}
int main() {
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  };
  auto start = chrono::steady_clock::now();
  long long t = 1;
  while (t--) solve();
  auto end = chrono::steady_clock::now();
  return 0;
}
