#include <stdio.h>

int main(){
  int a;
  int count;
  int max;
  scanf("%d",&max);
  
  for(count = 0;max - 1 <= count;count + 1){
    if(count % 3 == 0){
      
    }else{
     if(count % 5 == 0){
       
     }else{
       a = a + count;
     }
      
    }
    
    
    
  }
  printf("%d",a);
  return 0;
}