package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func Scanner() string { sc.Scan() return sc.Text() } func main() { buf := make([]byte, 0) sc.Buffer(buf, 100000007) sc.Split(bufio.ScanWords) a := make([]int, 5) for i := 4; i >= 0; i-- { a[i], _ = strconv.Atoi(Scanner()) } ans := 0 for i, j := 1, 1; i <= a[0]; i, j = j, i+j { if a[0] == i { count := 0 num := i num2 := j for k := 0; k < 5; k++ { if a[k] == num { count++ num, num2 = num2, num+num2 } else { break } } ans = max(ans, count) } } fmt.Println(ans) } func max(x int, y int) int { if x >= y { return x } else { return y } }