Tree Edges

Tree Edges

Easy Computer Mathematics Graph Theory Basics 29 views
Explanation Complexity

Problem Statement

Given number of nodes n in a tree, print number of edges.

Input Format

One integer n.

Output Format

One integer.

Example

5
4

Constraints

n>=1

Input / Output Format

Input Format
One integer n.
Output Format
One integer.
Constraints
n>=1

Examples

Input:
5
Output:
4

Example Solution (Public)

Computer Mathematics
A tree with n nodes has n-1 edges.

Official Solution Code

A tree with n nodes has n-1 edges.
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.