def count_variables(expr):
    """Count variables with the same value.

        >>> count_variables('xxy')
        {
            'x': 2,
            'y': 1
        }
    """
    result = {}
    variables = []
    for x in list(expr):
        if x not in variables:
            variables.append(x)
    for x in variables:
        result[x] = expr.count(x)
    return result
