https://www.acmicpc.net/problem/16204
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner s=new Scanner(System.in);
int n=s.nextInt();
int m=s.nextInt();
int k=s.nextInt();
System.out.print(Math.min(m,k)+Math.min(n-m,n-k));
}
}