print((lambda n,m,k:min(m,k) + min(n-m,n-k))(*list(map(int, input().split()))))