#include <bits/stdc++.h>
using namespace std;
template <class T>
void read(T& num) {
  char CH;
  bool F = false;
  for (CH = getchar(); CH < '0' || CH > '9'; F = CH == '-', CH = getchar())
    ;
  for (num = 0; CH >= '0' && CH <= '9';
       num = num * 10 + CH - '0', CH = getchar())
    ;
  F && (num = -num);
}
const int maxn = 2e5 + 100;
const int inf = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
inline long long mul(long long a, long long b) {
  long long c = a * b - (long long)((long double)a * b / mod + 0.5) * mod;
  return c < 0 ? c + mod : c;
}
vector<int> g[maxn];
int vis[maxn], flag = 1;
int c[3];
void dfs(int x, int col) {
  vis[x] = col;
  c[col]++;
  for (int i = 0; i < g[x].size(); i++) {
    int y = g[x][i];
    if (vis[y] == 0) {
      dfs(y, 3 - col);
    } else if (vis[y] == col) {
      flag = 0;
    }
  }
}
int main() {
  int n;
  read(n);
  for (int i = 1; i < n; i++) {
    int x, y;
    read(x);
    read(y);
    g[x].push_back(y);
    g[y].push_back(x);
  }
  dfs(1, 1);
  printf("%d\n", min(c[1], c[2]) - 1);
}
