没什么好说的,附上容斥原理的公式吧

alt

百度百科:https://baike.baidu.com/item/%E5%AE%B9%E6%96%A5%E5%8E%9F%E7%90%86/10146840?fr=ge_ala

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define PII pair<int,int>
const int N = 2e5 + 10;
//U - 2 - 5 - 11 -13 + 2^5 + 2^11 + 2^13 + 5^11 + 5^13 + 11^13
//WA:漏了一项
int main() {
	ll n;
	while (cin >> n) {
		ll sum = n / 2 + n / 5 + n / 11 + n / 13 
			- n / (2 * 5) - n / (2 * 11) - n / (2 * 13)
			- n / (5 * 13) - n / (5 * 11) - n / (11 * 13)
			+ n / (2 * 5 * 11) + n / (2 * 5 * 13) + n/(2*11*13) + n / (5 * 11 * 13)
			- n / (2 * 5 * 11 * 13);
		cout << n - sum << "\n";
	}
	return 0;
}