#include<iostream>
using namespace std;
int main()
{
int count = 0;
for (int i = 1; i <= 2020; ++i)
{
int temp = i;
while (temp)
{
if (temp % 10 == 2) count++;
temp /= 10;
}
}
cout << count;
return 0;
}