링크 : https://www.acmicpc.net/problem/1065
/*
문제 : 로프
링크 : https://www.acmicpc.net/problem/2217
*/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n;
cin >> n;
int ans = 99;
bool flag = true;
if(n < 100) cout << n;
else{
for(int i = 100; i <= n; i++){
string s = to_string(i);
for(int j = 2; j < s.size(); j ++){
if((s[j] - s[j-1]) != (s[j-1] - s[j-2]))
flag = false;
break;
}
if(flag == true) ans++;
flag = true;
}
cout << ans;
}
return 0;
}