#include using namespace std; ifstream fin("tsuk.in"); ofstream fout("tsuk.out"); int n,arr[8],m,a[131072],used[16],h[131072*16]; int solve(int x) { int o=0,i; int t=x; while(t) { if(used[t%10])o++; t/=10; } t=x; for(i=0;i>m; for(i=0; i>arr[i]; used[arr[i]]=1; } fin>>n; for(i=0; i>a[i]; } for(i=1; i<=1000000; i++) { h[i]=solve(i); } int l; for(i=1; i<=1000000-n; i++) { l=0; for(j=0; j