When Phil was a boy he kept a centipede. Centipedes have many legs. Phil's centipede had n legs in total: some of them were left legs and the rest were right legs. Every day the centipede used some of its legs, and it always used at least one left leg and at least one right leg.
Each day Phil wrote down in his notebook how many left legs and how many right legs the centipede used that day.
Phil now wants to recover from his notes how many left legs and how many right legs his centipede had. Phil was not accurate, so some notes may be wrong. A note li,ri is correct if the centipede had at least li left legs and at least ri right legs.
Choose a number of left legs and a number of right legs that makes the number of correct notes as large as possible. Each of the two counts is at least 1, and together they add up to n.