#include #include #include using namespace std; using ll = long long int; #define PREPARED_ENVIRONMENT template std::ostream& operator<<(std::ostream& o, const std::vector& v) { o << "{"; for (int i = 0; i < (int) v.size(); i++) o << (i > 0 ? ", " : "" ) << v[i]; o << "}"; return o; } template std::ostream& operator<<(std::ostream& o, const std::pair& p) { o << "(" << p.first << ", " << p.second << ")"; return o; } ll n; ll ans = 0; vector> graph; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> n; graph = vector>(n); for (int i = 0; i < (n - 1); i++) { int a, b; cin >> a >> b; a--; b--; graph[a].push_back(b); graph[b].push_back(a); } for (int i = 0; i < n; i++) { ans += max(0, (int) (graph[i].size())-2); } cout << ans << "\n"; return 0; }