#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <cstdlib>

using namespace std;

int main() {
    const char *prvih20[] = {
	"" /*zero*/, "one", "two", "three", "four", "five", "six", "seven",
	"eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen",
	"fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty"
    };
    vector<string> brojevi(1001);

    copy(prvih20, prvih20 + 21, brojevi.begin());
    
    brojevi[30] = "thirty";
    brojevi[40] = "forty";
    brojevi[50] = "fifty";
    brojevi[60] = "sixty";
    brojevi[70] = "seventy";
    brojevi[80] = "eighty";
    brojevi[90] = "ninety";
    brojevi[100] = "onehundred";
    brojevi[200] = "twohundred";
    brojevi[300] = "threehundred";
    brojevi[400] = "fourhundred";
    brojevi[500] = "fivehundred";
    brojevi[600] = "sixhundred";
    brojevi[700] = "sevenhundred";
    brojevi[800] = "eighthundred";
    brojevi[900] = "ninehundred";
    brojevi[1000] = "onethousand";

    for (string::size_type i = 2; i != 10; ++i)
	for (string::size_type j = 1; j != 10; ++j)
	    brojevi[10 * i + j] = brojevi[10 * i] + brojevi[j];
    
    for (string::size_type i = 1; i != 10; ++i)
	for (string::size_type j = 1; j != 100; ++j)
	    brojevi[100 * i + j] = brojevi[100 * i] + "and" + brojevi[j];
    
    cout << accumulate(brojevi.begin(), brojevi.end(), string()).size() << endl;

    return EXIT_SUCCESS;
}
