#include<iostream>
using namespace std;
int main()
{
//前面59个数只能构造出来一个2023,故年份不用再判断
int a[41]={3,8,5,1,6,3,4,6,7,0,7,8,2,7,6,8,9,5,6,5,6,1,4,0,1,0,0,9,4,8,0,9,1,2,8,5,0,2,5,3,3};
int months[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; // 定义每个月份的天数
int ans = 0;
for(int i= 1;i <= 12; i++){
for(int j = 1;j <= months[i]; j++){
int four[4];//存储数位
if(i < 10){
four[0] = 0;
four[1] = i;
}
else{
four[0] = 1;
four[1] = i % 10;
}
if(j < 10){
four[2] = 0;
four[3] = j;
}
else {
four[2] = j / 10;
four[3] = j % 10;
}
int t = 0; //已经匹配数字成功的个数
for(int k = 0; k < 41; k++){
if(a[k] == four[t])
t++;
if(t == 4){
ans ++;
break;
}
}
}
}
cout << ans;
return 0;
}