#!/usr/bin/perl -w

use v5.16;

my $count;
NUM:
for (347312..805915) {
	next if !/(.)\1/;
	my $prev = 0;
	for my $d (split //) {
		next NUM if $d < $prev;
		$prev = $d;
	}
	$count++;
}

say $count;

