// eddy1021
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
#define mod9 1000000009LL
#define mod7 1000000007LL
#define INF  1023456789LL
#define INF16 10000000000000000LL
#define eps 1e-9
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#ifndef ONLINE_JUDGE
#define debug(...) printf(__VA_ARGS__)
#else 
#define debug(...)
#endif
inline LL getint(){
  LL _x=0,_tmp=1; char _tc=getchar();    
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline LL add( LL _x , LL _y , LL _mod = mod7 ){
  _x += _y;
  return _x >= _mod ? _x - _mod : _x;
}
inline LL sub( LL _x , LL _y , LL _mod = mod7 ){
  _x -= _y;
  return _x < 0 ? _x + _mod : _x;
}
inline LL mul( LL _x , LL _y , LL _mod = mod7 ){
  _x *= _y;
  return _x >= _mod ? _x % _mod : _x;
}
LL mypow( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 1LL;
  LL _ret = mypow( mul( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = mul( _ret , _a , _mod );
  return _ret;
}
LL mymul( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 0LL;
  LL _ret = mymul( add( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = add( _ret , _a , _mod );
  return _ret;
}
inline bool equal( D _x ,  D _y ){
  return _x > _y - eps && _x < _y + eps;
}
void sleep( double sec = 1021 ){
  clock_t s = clock();
  while( clock() - s < CLOCKS_PER_SEC * sec );
}
#define Bye exit(0)
int __ = 1 , _cs;
/*********default*********/
#define N 101010
void build(){

}
int n;
vector<int> v[ N ];
void init(){
  n = getint();
  for( int i = 1 ; i < n ; i ++ ){
    int ui = getint();
    int vi = getint();
    v[ ui ].push_back( vi );
    v[ vi ].push_back( ui );
  }
}
vector< int > ls[ N ] , rs[ N ] , lc[ N ] , rc[ N ];
int dp[ N ] , dpc[ N ];
void go( int now , int prt ){
  ls[ now ].resize( v[ now ].size() );
  lc[ now ].resize( v[ now ].size() );
  rs[ now ].resize( v[ now ].size() );
  rc[ now ].resize( v[ now ].size() );
  int cnt_son = 0;
  for( size_t i = 0 ; i < v[ now ].size() ; i ++ ){
    ls[ now ][ i ] = lc[ now ][ i ] = 0;
    rs[ now ][ i ] = rc[ now ][ i ] = 0;
    int son = v[ now ][ i ];
    if( son == prt ) continue;
    cnt_son ++;
    go( son , now );
    ls[ now ][ i ] = rs[ now ][ i ] = dp[ son ];
    dp[ now ] += dp[ son ];
    if( dp[ son ] ){
      lc[ now ][ i ] = rc[ now ][ i ] = 1;
      dpc[ now ] ++;
    }
  }
  for( size_t i = 1 ; i < v[ now ].size() ; i ++ ){
    ls[ now ][ i ] += ls[ now ][ i - 1 ];
    lc[ now ][ i ] += lc[ now ][ i - 1 ];
  }
  for( int i = (int)v[ now ].size() - 2 ; i >= 0 ; i -- ){
    rs[ now ][ i ] += rs[ now ][ i + 1 ];
    rc[ now ][ i ] += rc[ now ][ i + 1 ];
  }
  if( dpc[ now ] < cnt_son - 1 )
    dp[ now ] += cnt_son - 1 - dpc[ now ];
}
int ans;
void go2( int now , int prt , int pdp ){
  {
    int cur_dp = pdp , cur_dpc = (pdp > 0);
    for( int son : v[ now ] ){
      if( son == prt ) continue;
      cur_dp += dp[ son ];
      cur_dpc += (dp[ son ] > 0);
    }
    if( cur_dpc < (int)v[ now ].size() - 1 )
      cur_dp += (int)v[ now ].size() - 1 - cur_dpc;
    //printf( "%d pdp = %d cur_dp = %d\n" , now , pdp , cur_dp );
    ans = min( ans , cur_dp );
  }
  for( size_t i = 0 ; i < v[ now ].size() ; i ++ ){
    int son = v[ now ][ i ];
    if( son == prt ) continue;
    int ssdp = pdp , ssdpc = (pdp > 0);
    if( i ){
      ssdp += ls[ now ][ i - 1 ];
      ssdpc += lc[ now ][ i - 1 ];
    }
    if( i + 1 < v[ now ].size() ){
      ssdp += rs[ now ][ i + 1 ];
      ssdpc += rc[ now ][ i + 1 ];
    }
    if( ssdpc < (int)v[ now ].size() - 2 )
      ssdp += (int)v[ now ].size() - 2 - ssdpc;
    go2( son , now , ssdp );
  }
}
void solve(){
  go( 0 , 0 );
  ans = dp[ 0 ];
  for( size_t i = 0 ; i < v[ 0 ].size() ; i ++ ){
    int son = v[ 0 ][ i ];
    int ssdp = 0 , ssdpc = 0;
    if( i ){
      ssdp += ls[ 0 ][ i - 1 ];
      ssdpc += lc[ 0 ][ i - 1 ];
    }
    if( i + 1 < v[ 0 ].size() ){
      ssdp += rs[ 0 ][ i + 1 ];
      ssdpc += rc[ 0 ][ i + 1 ];
    }
    if( ssdpc < (int)v[ 0 ].size() - 2 )
      ssdp += (int)v[ 0 ].size() - 2 - ssdpc;
    go2( son , 0 , ssdp );
  }
  ans ++;
  printf( "%d\n" , ans );
}
int main(){
  build();
  //__ = getint();
  while( __ -- ){
    init();
    solve();
  }
}


Measured memory_bytes: 41984