LearnPy Hub
← Arena
IntermediateRating 1100

Leaves of a Tree

A tree with n nodes is given as n − 1 edges. Print the number of leaves (nodes with exactly one neighbour; a single node counts as one leaf).

Input

n, then n − 1 lines 'u v'.

Output

A count.

Sample 1

Input
5
1 2
1 3
3 4
3 5
Output
3

Sample 2

Input
1
Output
1
solution.py
Output appears here
Leaves of a Tree · Python Arena problem · LearnPy Hub