#include<bits/stdc++.h>
using namespace std;
int main(){
int w,i=1,j=0,n;
cin>>n;
while(i<=n){
j=i;
while(j>0){
w=j%10;
j=j/10;
if(i%2==0){
if(w==3||w==5){
cout<<i<<endl;
}
}
}
i=i+1;
}
}
/**************************************************************
Problem: 1714
User: caiqiaoxi
Language: C++
Result: Accepted
Time:8 ms
Memory:2072 kb
****************************************************************/