import java.util.*;

public class TimerTest2
{
  public static void main(String[] args)
  {
    int count = Integer.parseInt(args[0]);      // get the countdown
    Timer timer = new Timer();                  // create a timer
    TimerTask cDown = new CountDown(count);     // create the countdown object

    timer.schedule(cDown, 0, 1000);             // register cDown with the timer
  }
}

// this class performes as the timer listener
class CountDown extends TimerTask 
{
    private int c;                              // the caountdown value

    public CountDown(int c)                     // creating the class instance
    {
      super();                                  // invoking the superclass cosntructor
      this.c = c;                               // setting the sountdown
    }

    public void run()                           // this method will be called
    {                                           // at each timer event
      System.out.println(c);
      if (c > 0)
        c--;
      else
        System.exit(0);
    }
}

