def _sum num1 num2 temp str num1 000 temp1 str num2 000 ch1 int temp i

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
def _sum(num1,num2):
temp = ( str(num1) ) + '000';
temp1 = ( str(num2) ) + '000';
ch1 = (int(temp[0])+int(temp[1])+int(temp[2]));
ch2 = (int(temp1[0])+int(temp1[1])+int(temp1[2]));
if (ch1 == ch2): return 1;
count = 0;
for a in xrange(0,999):
for b in xrange(0,999):
if (_sum(a,b)): count += 1;
print count;