#include<stdio.h>
int main(){
  int N, count=0;
  while(1){
  scanf("%d",&N);
  if(N==0){
    break;
  }
  if(N>3 && N%2==1){
    count++;
  }if(N>6 && N%3==0){
    count++;
  }if(N>10 && N%4==2){
    count++;
  }if(N>15 && N%5==0){
    count++;
  }if(N>21 && N%6==3){
    count++;
  }if(N>28 && N%7==0){
    count++;
  }
  printf("%d\n",count);
  }
  return 0;
}