### Problem Statement

Let us call a non-negative integer a decreasing number if the digits in its decimal representation are in descending order from left to right. For example, 321 and 950 are decreasing numbers, but 322 and 958 are not. List d is the list of all decreasing numbers, sorted in ascending order. Return the n-th element of d (n is 0-indexed), or -1 if no such element exists.

### Definition

 Class: DecreasingNumbers Method: getNth Parameters: int Returns: long Method signature: long getNth(int n) (be sure your method is public)

### Constraints

-n will be between 0 and 1000000, inclusive.

### Examples

0)

 `0`
`Returns: 0`
 The list d begins with zero.
1)

 `18`
`Returns: 42`
 The eighteenth number is 42.
2)

 `500000`
`Returns: -1`

#### Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=8002

#### Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=13531&pm=8002

FedorTsarev

#### Testers:

PabloGilberto , Olexiy , ivan_metelsky

#### Problem categories:

Brute Force, Sorting