spoj0; solve "Islands" from Contest 61