Zadacha 8a

http://stackoverflow.com/a/22450955