#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int i,m=0,res,num;
for(i=1;i<=2022;i++)
{ num=i;
while(num)
{
res=num%10;
num/=10;
if(res==2) m++;
}
}
printf("%d",m);
return 0;
}