#include <iostream>
#include <cmath>
using namespace std;
int main()
{

    int sum = 0, ans;
    for (int i = 1; i <= 1000; i++)
    {
        ans = 0;
        double m = pow(i, 3); //pow double型
        m = (int)m;
        while (m)
        {
            ans += (int)m % 10;
            m /= 10;
        }
        if (ans == i)
            sum++;
    }
    cout << sum << endl;
    return 0;
}