#include using namespace std; int ans; int cal(int n) { int sum = 0; while (n) { if (n % 10 == 2) sum++; n /= 10; } return sum; } int main() { for (int i = 1; i <= 2020; i++) { ans += cal(i); } cout << ans << endl; return 0; }