Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- using namespace std;
- int main(){
- int n, x, y;
- int c = 0;
- cin >> n;
- map<int, int> g;
- for (int i = 0; i < n-1; ++i){
- cin >> x >> y;
- g[x]++;
- }
- for (map<int, int>::iterator it = g.begin(); it != g.end(); it++)
- if (it->second == 1) c++;
- cout << c << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement