def roman_2_int(n: str) -> int:
    """
    Converts roman number to integer.

    :param n: roman number
    :return: integer representation
    """

    conv_table = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
    c = [conv_table[x] for x in n]
    return sum(-x if i < len(n) - 1 and x < c[i + 1] else x for i, x in enumerate(c))