#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("trapv")
#pragma GCC target("sse4")

#include<bits/stdc++.h>
using namespace std;

typedef pair<int, int> pi;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef long long int ll;
typedef unsigned long long int  ull;
typedef priority_queue<ll> mxhpl;
typedef priority_queue<int> mxhpi;
typedef priority_queue<ll, vector<ll>, greater<ll>> mnhpl;
typedef priority_queue<int, vector<int>, greater<int>> mnhpi;

#define rep(i,start,end) for(ll i = start; i <= end; ++i)
#define rrep(i,end,start) for(ll i = end; i >= start; --i)
#define parr(a,n) rep(i,0,n-1){cout << a[i] << " ";}cout<<"\n"
#define sarr(a,n) rep(i,0,n-1)cin >> a[i]
#define pb push_back
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define mset(a,x) memset(a, x, sizeof(a))
#define ps(x,y) fixed<<setprecision(y)<<x //cout << ps(ans, decimal places);
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)

// DEBUGGING
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char* x) { cerr << '\"' << x << '\"'; }
void __print(const string& x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template<typename T, typename V>
void __print(const pair<T, V>& x) { cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}'; }
template<typename T>
void __print(const T& x) { int f = 0; cerr << '{'; for (auto& i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}"; }
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) { __print(t); if (sizeof...(v)) cerr << ", "; _print(v...); }
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

// Fast IO
void IO() {
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
#endif
}

#define MOD 1000000007

//CODE
/*******************************************************/
#define MX 100000 

ll n;

vvl gr(400001,vl());

bool vis[400001];
bool cycle = false;

int dfs(int i, int p = -1) {
  if (vis[i]) {
    cycle = true;
    return 0;
  }

  vis[i] = 1;

  int ans = 1;
  ll cntP = 0;
  for (auto j: gr[i]) {
    if (j == p && !cntP) {
      cntP++;
      continue;
    }
    ans += dfs(j,i);
  }
  
  return ans;
}

void solve() {
  cin >> n;
  // vector<pll> vp(n);
  ll u,v;

  mset(vis,0);
  
  rep(i, 0, n - 1) {
    cin >> u >> v;
    gr[u].pb(v);
    gr[v].pb(u);
  }

  ll ans = 0;

  rep(i,0,400000) {
    if (gr[i].size() == 0 || vis[i]) {
      continue;
    }

    cycle = false;
    ans += dfs(i);
    // debug(ans, cycle);
    if (!cycle) ans--;
  }

  cout << ans << "\n";

}

int main() {
  IO();
  int t = 1;

  // cin >> t;

  while (t--) {
    solve();
  }
  return 0;
}

/*******************************************************/

#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define endl "\n"
using namespace std;

vector<pair<int,int>>adj[205]; //wt vertex;

int32_t main() {

    fast

    int a, b, x, y;
    cin >> a >> b >> x >> y;

    // 100      200 
    // 1 		101
    for(int i=1;i<=100;i++){
    	adj[i].push_back({x,i+100});
    	adj[i+100].push_back({x,i});
    	if(i!=100){
    		adj[i+1].push_back({x,i+100});
    		adj[i+100].push_back({x,i+1});
    	}
    }
    for(int i=1;i<=99;i++){
    	adj[i].push_back({y,i+1});
    	adj[i+1].push_back({y,i});
    	adj[100+i].push_back({y,i+101});
    	adj[101+i].push_back({y,100+i});
    }

    vector<int>d;
    d.assign(205,1e18);
    d[a] = 0;
    multiset<pair<int,int>>q; //dist vertex
    q.insert({0,a});
    while(!q.empty()){
    	auto curr = *q.begin();
    	q.erase(q.begin());
    	int v = curr.second;

    	for(auto neigh:adj[v]){
    		int to =neigh.second;
    		int len = neigh.first;
    		if(d[to]>d[v]+len){
    			q.erase({d[to],to});
    			d[to] = d[v]+len;
    			q.insert({d[to],to});
    		}
    	}
    }
    cout << d[b+100] << endl;

    // y = min(y,2*x);
    // if(a>b){
    // 	// int ans = (a-b)*x+(a-b-1)*(x);
    // 	// ans = min(ans,(a-b)*x+y);
    // }
    // else if(a!=b){
    // 	int ans = 2;
    // }
    // ans = (a-b-)
    // // if(b>a){
    // // 	swap(a,b);swap(x,y);
    // // }
    // // if()
    // // if(2*x<y){
    // int ans = abs(b - a) * (2 * x + x);
    // // if(a > b)
    //     ans = min(ans, max(0LL, (abs(b - a) - 1)) * y + x);
    // cout << ans << endl;
    // // }
    // // else{
    // // 	int ans = max(0LL,(abs(b-a)-1))*y+x;
    // // 	cout << ans << endl;
    // // }

    return 0;
}