#include<bits/stdc++.h>
using namespace std;
int main(){
	int	i,h;
	while(i<=500){
		if(i%3==2&&i%5==3&&i%7==2){
			h++;
			cout<<h<<endl; 
		} 
		i++;
	}

}
/**************************************************************
	Problem: 1021
	User: huanglingkai
	Language: C++
	Result: Wrong Answer
****************************************************************/