from functools import wraps
def counter(f):
    count=0
    @wraps(f)
    def wrapper(*args):
        global count
        count=count+1
        return f(*args)
    def counter():
        return count
    f.counter=counter
    return wrapper 





@counter
def fun(a, b):
    return a * 1 + b

print(fun.counter())
res = sum(fun(i, i + 1) for i in range(5))
print(fun.counter(), res)