using System; using System.Collections.Generic; using System.Linq; using static System.Console; class Program { static void Main() { WriteLine(ReadLine().Split().Select(int.Parse).ToList().SkipWhile((x, y) => x == y + 1).First() - 1); } }