#RELAYG. 超能力

超能力

Score : 100100 points

Problem Statement

You have NN cups and 11 ball.

The cups are arranged in a row, from left to right.

You turned down all the cups, then inserted the ball into the leftmost cup.

Then, you will perform the following QQ operations:

  • The ii-th operation: swap the positions of the AiA_i-th and BiB_i-th cups from the left. If one of these cups contains the ball, the ball will also move.

Since you are a magician, you can cast a magic described below:

  • Magic: When the ball is contained in the ii-th cup from the left, teleport the ball into the adjacent cup (that is, the (i1)(i-1)-th or (i+1)(i+1)-th cup, if they exist).

The magic can be cast before the first operation, between two operations, or after the last operation, but you are allowed to cast it at most once during the whole process.

Find the number of cups with a possibility of containing the ball after all the operations and possibly casting the magic.

Constraints

  • 2N1052 \leq N \leq 10^5
  • 1Q1051 \leq Q \leq 10^5
  • 1Ai<BiN1 \leq A_i < B_i \leq N

Input

The input is given from Standard Input in the following format:

NN QQ

A1A_1 B1B_1

A2A_2 B2B_2

:

AQA_Q BQB_Q

Output

Print the number of cups with a possibility of eventually containing the ball.

10 3
1 3
2 4
4 5
4
20 3
1 7
8 20
1 19
5