## Problem 1. Moocast

Contest has ended.

Log in to allow submissions in analysis mode

Farmer John's $N$ cows ($1 \leq N \leq 1000$) want to organize an emergency "moo-cast" system for broadcasting important messages among themselves.

Instead of mooing at each-other over long distances, the cows decide to equip themselves with walkie-talkies, one for each cow. These walkie-talkies each have a limited transmission radius, but cows can relay messages to one-another along a path consisting of several hops, so it is not necessary for every cow to be able to transmit directly to every other cow.

4
1 3
5 4
7 2
6 1

#### SAMPLE OUTPUT:

17

Problem credits: Richard Peng

Contest has ended. No further submissions allowed.