import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Tester2 { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int y = Integer.parseInt(br.readLine()); if(1970<=y && y<=2017) System.out.println(2017-y); } }