#!/bin/bash
':' /*
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro node:5.2-slim \
  /bin/bash -c "node /vo/$(basename $0) < /vo/g.inp"; exit $?
exit 0
*/

"use strict";

const main = (input) => {
  let mask = 0;
  for(let x of Array.from(input.split("\n"), x=> Number(x)-1)){
    mask += Math.pow(2,x);
  }
  return Math.log2(0b111 ^ mask) + 1;
};
console.log(main(require("fs").readFileSync("/dev/stdin", "utf-8").trim()));
