#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
using ll = long long;
bool isPrime(ll n) { // O(sqrt(n))
if (n < 2) return false;
for (ll i = 2; i * i <= n; i++) {
if (n % i == 0) {
return false;
}
}
return true;
}
int main() {
ios::sync_with_stdio(false); cin.tie(0);
vector<int> prime;
for(int i = 2; i <= 1000; i++) {
if(isPrime(i)) prime.push_back(i);
}
int x, ans = 0;
cin >> x;
for(int a = 1; a <= x; a++) {
for(int b = 1; b <= x; b++) {
if(a + b + 1 > x) break;
auto it1 = upper_bound(prime.begin(), prime.end(), a + b);
auto it2 = upper_bound(prime.begin(), prime.end(), x);
ans += it2 - it1;
}
}
cout << ans << endl;
return 0;
}