#include <iostream>

using namespace std;
int K,N,C;
bool flag=false;
int main()
{
  cin>>N;
  int count=0;
  for(int i=1;i<N+1;i++){
    if(i%3==0||i%5==0){
    }else{
      count+=i;
    }
  }
  cout<<count;
  return 0;
}


