Ham and Bean Soup with Rosemary