407246: GYM102709 B Office Hours

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Office Hourstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Deja has been battling with a frustrating race condition on her cooperative multithreading assignment in her operating systems class. She decides to go to the TA's zoom office hours the day before the assignment is due and finds a lot of her peers in the same predicament! The TA is overwhelmed and informs the $$$n$$$ students in the call to remember what order that they joined the call in so that the TA can answer their questions in that order. Deja was so preoccupied with her perplexing bug that she forgot where exactly in the queue of students that she was. She does know, however, that there were at least $$$x$$$ people ahead of her and no more than $$$y$$$ students behind her. Help Deja figure out how many different positions in the queue that she could be at.

Input

There is only one line of input which contains three space-separated integers, $$$n$$$, $$$x$$$, and $$$y$$$ ($$$1 \leq x, y < n \leq 1,000,000$$$)

Output

Output a single integer representing the number of different positions in the queue Deja could be at. It is guaranteed that there will be at least one valid position for Deja to be at.

ExamplesInput
4 2 1
Output
2
Input
6 1 3
Output
4
Note

In the first sample, Deja could be at positions $$$3$$$ or $$$4$$$ (if the positions are one-indexed) and this would ensure that she has at least two people in front of her and at most one person after her.

Similar logic means that for the second sample, she could be at positions $$$3$$$, $$$4$$$, $$$5$$$, and $$$6$$$ (again one-indexing the positions).

加入题单

上一题 下一题 算法标签: