#include <bits/stdc++.h>
using namespace std;
const int maxN = 3e5 + 8, MOD = 1e9 + 7;
int n;
vector<int> adj[maxN];
int dp[maxN][3];
void calc(int nd, int an) {
  dp[nd][0] = 1;
  int be = MOD;
  for (int sn : adj[nd]) {
    if (sn != an) {
      calc(sn, nd);
      dp[nd][0] += min(dp[sn][1], min(dp[sn][0], dp[sn][2]));
      dp[nd][2] += dp[sn][1];
      dp[nd][1] += min(dp[sn][0], dp[sn][1]);
      be = min(be, dp[sn][0] - dp[sn][1]);
      for (int i = 0; i < 3; i++) dp[nd][i] = min(MOD, dp[nd][i]);
    }
  }
  if (be < 0) be = 0;
  dp[nd][1] += be;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 1, u, v; i < n; i++) {
    cin >> u >> v;
    u--, v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  calc(0, -1);
  for (int i = 0; i < n; i++) {
  }
  int ans = 0;
  for (int sn : adj[0]) {
    ans += dp[sn][0] - 1;
  }
  cout << ans << '\n';
}
