/* -*- coding: utf-8 -*- * * 806.cc: No.806 木を道に - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 100000; /* typedef */ typedef vector vi; /* global variables */ vi nbrs[MAX_N]; /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); for (int i = 1; i < n; i++) { int a, b; scanf("%d%d", &a, &b); a--, b--; nbrs[a].push_back(b); nbrs[b].push_back(a); } int cnt = 0; for (int i = 0; i < n; i++) if (nbrs[i].size() > 2) cnt += nbrs[i].size() - 2; printf("%d\n", cnt); return 0; }