'use strict'

const Main = input => {
  const K = Number(input);

  let x = 0n;

  for(let i=0; i<K; i++) {
    if(!isLunlun(++x)) {
      i--;
      continue;
    }
    console.log(i);

    if(i === K-1) break;
  }

  console.log(String(x));
};

const isLunlun = num => {
  const str = String(num);
  let isLunlun = true;
  for(let i=1; i<str.length; i++) {
    if(Math.abs(Number(str[i-1]) - Number(str[i])) > 1) {
      isLunlun = false;
      break;
    }
  }
  return isLunlun;
};

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));
