#include<bits/stdc++.h>
#include<sstream>
#define ll long long int
#include <stdlib.h>
#include <vector>
#define pi acos(-1)
#define maxm 100005
#define pb push_back
#define MOD 1e9+7
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
///s1.substr(1,3);///STARTING FROM INDEX 1, 3 LNEGTH SUBSTRING.
///s1.find("adn")///RETURNS STARTING INDEX OF THE SUBSTRING
///"adn" IF IT EXISTS IN THE STRING S1.///
///s1.find("adn",int pos);///RETURNS STARTING INDEX OF THE
///SUBSTRING "adn" SEARCHING FROM INDEX POS OF STRING s1.///
///string::npos returns a garbage value if not found...
///reverse(s1.begin(),s1.end())-> to reverse a string.
///next_permutation(f,f+n)->f array er next permutation return korbe..
///str.erase(1,2)->deletes 2 char from index 1..
///for(auto i:p2)->i=p2.begin() theke p2.end() er ag porjonto..
///max_element(v,v+4);->return a pointer to the max element
///in a array/vector.. v from 1st element to 4th element.
///same for min_element(v,v+4);
///__builtin_popcount(a);->counts how many number of one's
/// in a in binary representation.
///accumulate(l1+1,l1+10+1,0LL)=>it perform the sum from l1[1] to
///l1[10] and 0 is the initial sum.
///cout<<fixed<<setprecision(12)<<x14<<endl;//=>x14 er
///doshomik er por 12 ta 0 thakbe.
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define gcd(a,b) __gcd(a,b)
using namespace std;

ll l1[500005],l2[500005],vis[4000005],vis2[1000005],s=0,m;
ll dx[]={1,0,-1,0};
ll dy[]={0,-1,0,1};

//vector<ll>v[5];
//set<ll>v2;
//map<ll,ll>m2;
vector<pair<ll,ll>>p2;
vector<pair<ll,ll>>p3;

char s2[maxm];
//int sum[max];
int tree[maxm*4];
//int prop[max*3];
void STB(int at,int L,int R)
{
    //int sum[at]=0;
    if(L==R){
        tree[at]=(s2[L-1]-'0');
        return;
    }
    int mid=(L+R)/2;
    STB(2*at,L,mid);
    STB(2*at+1,mid+1,R);
    //tree[at]=tree[2*at]+tree[2*at+1];
    //return sum[at];
}

void update(int at,int L,int R,int pos1,int pos2)
{
    if(L>pos2 || R<pos1)return;

    if(L>=pos1 && R<=pos2){
        tree[at]^=1;
        return;
    }
    int mid=(L+R)>>1;
//    if(pos2<=mid)update((at<<1)+1,L,mid,pos1,pos2);
//    else if(pos1>mid)update((at<<1)+2,mid+1,R,pos1,pos2);
//    else{
//        update((at<<1)+1,L,mid,pos1,mid);
//        update((at<<1)+2,mid+1,R,mid+1,pos2);
//    }
    update((at<<1),L,mid,pos1,pos2);
    update((at<<1)+1,mid+1,R,pos1,pos2);
    //tree[at]=tree[(at<<1)+1]+tree[(at<<1)+2]+prop[at]*(R-L+1);
}

int query(int at,int L,int R,int l)
{
    //if(L<=l && l<=R)return tree[at];
    if(L==R)return tree[at];
    if(L>l && l>R)return 0;

    int mid=(L+R)>>1;
//    if(l<=mid)query((at<<1)+1,L,mid,l,carry+prop[at]);
//    else query((at<<1)+2,mid+1,R,l,carry+prop[at]);
    if(l<=mid)return tree[at]^query((at<<1),L,mid,l);
    else return tree[at]^query((at<<1)+1,mid+1,R,l);
    //return ;
}

///reverse sorting function.
bool revp(const pair<ll,ll>&a,const pair<ll,ll>&b){
    if(a.first!=b.first)return a.first>b.first;
    else return a.second<b.second;
}
bool revp2(const pair<ll,ll>&a,const pair<ll,ll>&b){return a.second<b.second;}

ll ones(ll n){
    ll s=0;
    while(n>0){
        if(n&1)s++;
        n=n>>1;
        //cout<<n<<endl;
    }
    return s;
}

ll isprime(ll n)
{
    ll x=sqrt(n);
    for(int i=2;i<=x;i++){
        if(n%i==0)return 1;
    }
    return 0;
}
map<ll,ll>m2;
ll dfs(ll a)
{
    //if(vis[a])return 0;
    if(m2[a]==-1)return s;
    //vis[a]=1;
    s++;
    a=m2[a];
    dfs(a);
}

int main()
{
    //IOS;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ll t,i,j,k,x,y,q=-1,n,c,m,z,z2,l,r,cases=0,d,p,nl,np,a,e=1,b,x2=-1,x1=1000000005,x3=0,x4=0,x5=0,x6=0,x7=0,x8=0;
    double x10=100000,x14,x15,x16,x17,x18;char x11,y1,y2,y3;int x12=0;
    string s3,s4,s5,s6,s7,s8;
    queue<ll>q2;
    stack<ll>st;
    vector<ll>vp;
    map<ll,ll>mp;
    //set<ll>y4;
    //map<ll,ll>m2;
    map<ll,ll>::iterator it;
    map<ll,ll>m3;

    cin>>n;
    for(int i=1;i<=n;i++){
        if(i%3==0||i%5==0)x3+=0;
        else x3+=i;
    }
    cout<<x3<<endl;

    return 0;
}


Measured memory_bytes: 3616