Next Greater Numerically Balanced Number

A number is numerically balanced when every digit d that appears in its decimal representation occurs exactly d times. Digit 1 therefore appears once, digit 2 appears twice, digit 3 appears three times, and so on. Digit 0 can never appear, because a present digit cannot occur zero times.

Given an integer n, return the smallest numerically balanced number that is strictly greater than n.

Examples
Input: 1
Output: 22
Hints

Next Greater Numerically Balanced Number

A number is numerically balanced when every digit `d` that appears in its decimal representation occurs exactly `d` times. Digit `1` therefore appears once, digit `2` appears twice, digit `3` appears three times, and so on. Digit `0` can never appear, because a present digit cannot occur zero times.