Всего 132052 чисел.
type ArrInteger = Array of Integer;
function getDigits8Base(num: Longword; digitCount: Integer): ArrInteger;
var
digits: ArrInteger;
i: Integer;
begin
setLength(digits, digitCount);
for i := 0 to digitCount - 1 do begin
digits[i] := num mod &10;
num := num div &10;
end;
getDigits8Base := digits;
end;
function sum(arr: ArrInteger; first, last: Integer): Integer;
var
i, accumulator: Integer;
begin
accumulator := 0;
for i := first to last do
accumulator := accumulator + arr[i];
sum := accumulator;
end;
var
n, count: Longword;
digits: ArrInteger;
begin
count := 0;
for n := &100000 to &777777 do begin
digits := getDigits8Base(n, 6);
if abs(sum(digits, 0, 2) - sum(digits, 3, 5))
count := count + 1;
end;
writeln(count);
end.