Timus 1005
Ugly numbers