#include <bits/stdc++.h>
#include <string.h>
#include <array>
using namespace std;

int proizvod_cifara(int n){
int p = 0;
for(int i = 1;i <= n;i++){
if(i == 0)
    return 0;
else
    p += i % 10;
}
return p;
}

int main()
{
    int T;
    int n;
    cin  >> T;
        cin >> n;

    vector<int>niz[n+1];
    int p1;
    for(int j = 0;j < n;j++){
        p1 = proizvod_cifara(j);
        niz[n].push_back(p1);
    }
    unordered_set<int> jedinstveni(niz[n].begin(), niz[n].end());
    cout << jedinstveni.size() << endl;
    return 0;
}