#include<iostream>
#include<vector>
using namespace std;
int count=0;
int main()
{
for(int i=1;i<100000000;i++)
{
int x=0,y=0;
vector<int>a;
int num=i;
while(num>0)
{
a.push_back(num%10);
num=num/10;
}
if(a.size()%2==0)
{
for(int i=0;i<(int)a.size()/2;i++)
{
x=x+a[i];
y=y+a[i+a.size()/2];
}
if(x==y)
{
count++;
}
}
}
cout<<count;//4430091
return 0;
}