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