"use strict";

function main(arg) {
    const input = arg.split("\n")
    const X = input[0].split(" ").map(x=>Number(x))
    const N = 5
    
    let sum = X.reduce((a,b)=>a+b)

    console.log(15-sum)
    
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));