#include<stdio.h>
#include<vector>
using namespace std;
int main()
{
int n;
scanf("%d", &n);
vector<int> count(10, 0);
for(int i = 1; i <= n; i++)
{
int idx = 0;
int x = i;
while(x >= 1)
{
idx = x % 10;
count[idx]++;
x /= 10;
}
}
printf("%d", count[3]);
return 0;
}
1. 각 숫자마다 1의 자리수 추출 후 그 숫자 사용횟수를 count++ 한다.
2. 자릿수를 줄여가며 반복한다.
3. 3의 사용횟수를 출력한다.