#include <bits/stdc++.h>
using namespace std;
int main(){
    int i,n=0;
    cin>>i;
    for(int i1=1;i1<=i;i1++){
        for(int i2=1;i2<i1;i2++){
            if((i1+i2)%7==0||(i1+i2)%3==0)n++;
        }
    }
    cout<<n;
}
/**************************************************************
	Problem: 1086
	User: yangjunwen
	Language: C++
	Result: Accepted
	Time:9 ms
	Memory:2072 kb
****************************************************************/