// One and Two.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "iostream.h"

int main(int argc, char* argv[])
{
	int number,digit,oneCount,twoCount,TotalCount=0,k,total;

cout<<"Type in a number"<<endl;
cin>>total;

for (k=0;k<=total;k++)
{
	    number=k;
		oneCount=0;
		twoCount=0;

		do
		{
			digit=number % 10;
			if (digit==1)
				oneCount++;
   			else if (digit==2)
				twoCount++;
   
			number=number/10;
		}while (number>0);
		if (oneCount-twoCount==1)
			TotalCount++;
}
cout<<TotalCount;
	return 0;
}
