def read_charge(element):
    """Returns an integer corresponding to the charge of the element, up to 9.
    Example: read_charge('Xe^2+')
    """
    if element.endswith('+'):
        try:
            return int(element.split('+')[0][-1:])
        except ValueError:
            return 1
    elif element.endswith('-'):
        try:
            return -int(element.split('-')[0][-1:])
        except ValueError:
            return -1
    else:
        return 0
