Daenerys Targaryen has an army consisting of k groups of soldiers, the i-th group contains ai soldiers. She wants to bring her army to the other side of the sea to get the Iron Throne. She has recently bought an airplane to carry her army through the sea. The airplane has n rows, each of them has 8 seats. We call two seats neighbor, if they are in the same row and in seats {1, 2}, {3, 4}, {4, 5}, {5, 6} or {7, 8}.  A row in the airplane Daenerys Targaryen wants to place her army in the plane so that there are no two soldiers from different groups sitting on neighboring seats.Your task is to determine if there is a possible arranging of her army in the airplane such that the condition above is satisfied.

The first line contains two integers n and k (1 ≤ n ≤ 10000, 1 ≤ k ≤ 100) — the number of rows and the number of groups of soldiers, respectively. The second line contains k integers a1, a2, a3, ..., ak (1 ≤ ai ≤ 10000), where ai denotes the number of soldiers in the i-th group. It is guaranteed that a1 + a2 + ... + ak ≤ 8·n.

If we can place the soldiers in the airplane print "YES" (without quotes). Otherwise print "NO" (without quotes). You can choose the case (lower or upper) for each letter arbitrary.

NoteIn the first sample, Daenerys can place the soldiers like in the figure below:  In the second sample, there is no way to place the soldiers in the plane since the second group soldier will always have a seat neighboring to someone from the first group.In the third example Daenerys can place the first group on seats (1, 2, 7, 8), and the second group an all the remaining seats.In the fourth example she can place the first two groups on seats (1, 2) and (7, 8), the third group on seats (3), and the fourth group on seats (5, 6).

var l = readline().split(' ');

var ROW = parseInt(l[0]);
var K = parseInt(l[1]);

var ar = readline().split(' ').map((a)=>{return parseInt(a);});
ar.sort((a, b)=>{
  if(a%4===0) return -1;
  if(b%4===0) return 1;

  if(a%2===0) return -1;
  if(b%2===0) return 1;
  return b-a;
});

var four = ROW * 1;
var two = ROW * 2;

var r1s = 0;

var pass = true;
ar = ar.map((k)=>{

//	print(k);print(k, '2x'+two, '4x'+four, r1s, parseInt(k/4));

	if (four >= parseInt(k/4) ) {
    	four-= parseInt(k/4);
      	k-= parseInt(k/4)*4;
    } else if(parseInt(k/4) > 0) {
      	k-= four*4;
      	four = 0;
    }

	if (two >= parseInt(k/2) ) {
    	two-= parseInt(k/2);
      	k-= parseInt(k/2)*2;
    } else if(parseInt(k/2) > 0) {
      	k-= two*2;
      	two = 0;
    }

	if (four >= parseInt(k/3)) {
    	four-= parseInt(k/3);
      	k-= parseInt(k/3)*3;
    } else if(parseInt(k/3) > 0) {
      	k-= four*4;
      	four = 0;
    }

	if (four >= parseInt(k/2)) {
    	four-= parseInt(k/2);
      	r1s+= parseInt(k/2);
      	k-= parseInt(k/2)*2;
    } else if(parseInt(k/2) > 0) {
      	k-= four*2;
      	r1s+= four;
      	four = 0;
    }

  	if (r1s >= k) {
    	r1s -= k;
      	k = 0;
    }

	if (two >= k ) {
    	two-= k;
      	k-= k;
    }

	if (four >= k ) {
    	four-= k;
      	//r1s+= 2 * k;
      	two+= k;
      	k= 0;
    }

  	//print(k, '2x'+two, '4x'+four, r1s);

    if (k>0) pass=false;
  	//print((k>0) ? 'NOOOOO':'');

  	return k;
});

//print(ar.join(','))

print(pass ? "YES":"NO")

var l = readline().split(' ');

var ROW = parseInt(l[0]);
var K = parseInt(l[1]);

var ar = readline().split(' ').map((a)=>{return parseInt(a);});
ar.sort((a, b)=>{return b-a;});

var four = ROW * 1;
var two = ROW * 2;

var r1s = 0;

var pass = true;
ar = ar.map((k)=>{

//	print(k);
//  	print(k, '2x'+two, '4x'+four, r1s);

	if (four >= parseInt(k/4) ) {
    	four-= parseInt(k/4);
      	k-= parseInt(k/4)*4;
    }

  	if (four >= parseInt(k/3)) {
    	four-= parseInt(k/3);
      	k-= parseInt(k/3)*3;
    }

	if (two >= parseInt(k/2) ) {
    	two-= parseInt(k/2);
      	k-= parseInt(k/2)*2;
    }

	if (four >= parseInt(k/2)) {
    	four-= parseInt(k/2);
      	r1s+= parseInt(k/2);
      	k-= parseInt(k/2)*2;
    }

	if (two >= k ) {
    	two-= k;
      	k-= k;
    }

    if (r1s >= k) {
//		print('r1s=', r1s, k);
    	r1s -= k;
      	k = 0;
    }

	if (four >= k ) {
    	four-= k;
      	r1s+= 2;
      	k= 0;
    }

//  	print(k, '2x'+two, '4x'+four, r1s);

    if (k>0) pass=false;
//  	if (k%4 === 3) r3s+= parseInt(k/3);

  	return k;
});

//print(ar.join(','))

print(pass ? "YES":"NO")

var l = readline().split(' ');

var ROW = parseInt(l[0]);
var K = parseInt(l[1]);

var ar = readline().split(' ').map((a)=>{return parseInt(a);});
ar.sort((a, b)=>{
  if(a%4===0) return -1;
  if(b%4===0) return 1;

  if(a%2===0) return -1;
  if(b%2===0) return 1;
  return b-a;
});

var four = ROW * 1;
var two = ROW * 2;

var r1s = 0;

var pass = true;
ar = ar.map((k)=>{

	//print(k);print(k, '2x'+two, '4x'+four, r1s);

	if (four >= parseInt(k/4) ) {
    	four-= parseInt(k/4);
      	k-= parseInt(k/4)*4;
    }

  	if (four >= parseInt(k/3)) {
    	four-= parseInt(k/3);
      	k-= parseInt(k/3)*3;
    }

	if (two >= parseInt(k/2) ) {
    	two-= parseInt(k/2);
      	k-= parseInt(k/2)*2;
    }

	if (four >= parseInt(k/2)) {
    	four-= parseInt(k/2);
      	r1s+= parseInt(k/2);
      	k-= parseInt(k/2)*2;
    }

  	if (r1s >= k) {
    	r1s -= k;
      	k = 0;
    }

	if (two >= k ) {
    	two-= k;
      	k-= k;
    }

	if (four >= k ) {
    	four-= k;
      	r1s+= 2 * k;
      	k= 0;
    }

  	//print(k, '2x'+two, '4x'+four, r1s);

    if (k>0) pass=false;

  	return k;
});

//print(ar.join(','))

print(pass ? "YES":"NO")

var l = readline().split(' ');

var ROW = parseInt(l[0]);
var K = parseInt(l[1]);

var ar = readline().split(' ').map((a)=>{return parseInt(a);});
ar.sort((a, b)=>{return b-a;});

var four = ROW * 1;
var two = ROW * 2;

var r1s = 0;

var pass = true;
ar = ar.map((k)=>{

//	print(k);
//  	print(k, '2x'+two, '4x'+four);

	if (four >= parseInt(k/4) ) {
    	four-= parseInt(k/4);
      	k-= parseInt(k/4)*4;
    }

  	if (four >= parseInt(k/3)) {
    	four-= parseInt(k/3);
      	k-= parseInt(k/3)*3;
    }

	if (four >= parseInt(k/2)) {
    	four-= parseInt(k/2);
      	r1s+= parseInt(k/2);
      	k-= parseInt(k/2)*2;
    }

	if (two >= parseInt(k/2) ) {
    	two-= parseInt(k/2);
      	k-= parseInt(k/2)*2;
    }

	if (two >= k ) {
    	two-= k;
      	k-= k;
    }

    if (r1s >= k) {
//		print('r1s=', r1s, k);
    	r1s -= k;
      	k = 0;
    }

//  	print(k, '2x'+two, '4x'+four);

    if (k>0) pass=false;
//  	if (k%4 === 3) r3s+= parseInt(k/3);

  	return k;
});

//print(ar.join(','))

print(pass ? "YES":"NO")

var l = readline().split(' ');

var ROW = parseInt(l[0]);
var K = parseInt(l[1]);

var ar = readline().split(' ').map((a)=>{return parseInt(a);});
ar.sort((a, b)=>{
  if(a%4===0) return -1;
  if(b%4===0) return 1;

  if(a%2===0) return -1;
  if(b%2===0) return 1;
  return b-a;
});

var four = ROW * 1;
var two = ROW * 2;

var r1s = 0;

var pass = true;
ar = ar.map((k)=>{

//	print(k);print(k, '2x'+two, '4x'+four, r1s, parseInt(k/4));

	if (four >= parseInt(k/4) ) {
    	four-= parseInt(k/4);
      	k-= parseInt(k/4)*4;
    } else if(parseInt(k/4) > 0) {
      	k-= four*4;
      	four = 0;
    }

	if (two >= parseInt(k/2) ) {
    	two-= parseInt(k/2);
      	k-= parseInt(k/2)*2;
    } else if(parseInt(k/2) > 0) {
      	k-= two*2;
      	two = 0;
    }

	if (four >= parseInt(k/3)) {
    	four-= parseInt(k/3);
      	k-= parseInt(k/3)*3;
    } else if(parseInt(k/3) > 0) {
      	k-= four*4;
      	four = 0;
    }

	if (four >= parseInt(k/2)) {
    	four-= parseInt(k/2);
      	r1s+= parseInt(k/2);
      	k-= parseInt(k/2)*2;
    } else if(parseInt(k/2) > 0) {
      	k-= four*2;
      	r1s+= four;
      	four = 0;
    }

  	if (r1s >= k) {
    	r1s -= k;
      	k = 0;
    }

	if (two >= k ) {
    	two-= k;
      	k-= k;
    }

	if (four >= k ) {
    	four-= k;
      	r1s+= 2 * k;
      	k= 0;
    }

  	//print(k, '2x'+two, '4x'+four, r1s);

    if (k>0) pass=false;
  	//print((k>0) ? 'NOOOOO':'');

  	return k;
});

//print(ar.join(','))

print(pass ? "YES":"NO")

var l = readline().split(' ');

var ROW = parseInt(l[0]);
var K = parseInt(l[1]);

var ar = readline().split(' ').map((a)=>{return parseInt(a);});
ar.sort((a, b)=>{return b-a;});

var four = ROW * 1;
var two = ROW * 2;

var pass = true;
ar.forEach((k)=>{

 // print(k);

	if (four >= parseInt(k/4)) {
    	four-= parseInt(k/4);
      	k-= parseInt(k/4)*4;
    }

  	if (two >= (parseInt(k/2) + k%2) ) {
    	two-= (parseInt(k/2) + k%2);
      	k-= (parseInt(k/2)*2 + k%2);
    }

  //	print(k, '2x'+two, '4x'+four);

    if (k>0) pass=false;
});

print(pass ? "YES":"NO")

var l = readline().split(' ');

var ROW = parseInt(l[0]);
var K = parseInt(l[1]);

var ar = readline().split(' ').map((a)=>{return parseInt(a);});
ar.sort((a, b)=>{return b-a;});

var four = ROW * 1;
var two = ROW * 2;

var r1s = 0;

var pass = true;
ar = ar.map((k)=>{

	//print(k);print(k, '2x'+two, '4x'+four, r1s);

	if (four >= parseInt(k/4) ) {
    	four-= parseInt(k/4);
      	k-= parseInt(k/4)*4;
    }

  	if (four >= parseInt(k/3)) {
    	four-= parseInt(k/3);
      	k-= parseInt(k/3)*3;
    }

	if (two >= parseInt(k/2) ) {
    	two-= parseInt(k/2);
      	k-= parseInt(k/2)*2;
    }

	if (four >= parseInt(k/2)) {
    	four-= parseInt(k/2);
      	r1s+= parseInt(k/2);
      	k-= parseInt(k/2)*2;
    }

	if (two >= k ) {
    	two-= k;
      	k-= k;
    }

    if (r1s >= k) {
//		print('r1s=', r1s, k);
    	r1s -= k;
      	k = 0;
    }

	if (four >= k ) {
    	four-= k;
      	r1s+= 2 * k;
      	k= 0;
    }

  	//print(k, '2x'+two, '4x'+four, r1s);

    if (k>0) pass=false;

  	return k;
});

//print(ar.join(','))

print(pass ? "YES":"NO")


Several ages ago Berland was a kingdom. The King of Berland adored math. That's why, when he first visited one of his many palaces, he first of all paid attention to the floor in one hall. The floor was tiled with hexagonal tiles.The hall also turned out hexagonal in its shape. The King walked along the perimeter of the hall and concluded that each of the six sides has a, b, c, a, b and c adjacent tiles, correspondingly.To better visualize the situation, look at the picture showing a similar hexagon for a = 2, b = 3 and c = 4.  According to the legend, as the King of Berland obtained the values a, b and c, he almost immediately calculated the total number of tiles on the hall floor. Can you do the same?

The first line contains three integers: a, b and c (2 ≤ a, b, c ≤ 1000).

Print a single number — the total number of tiles on the hall floor.

print(function(a, b, c) {
	return a * b + a * (c - 1) + (b - 1) * (c - 1);
} .apply(0, readline().split(' ').map(Number)));

;(function () {
	print(function (a, b, c) {
		return f(a, b, c);

		function f (a, b, c) {
			if (a < 2 || b < 2 || c < 2) return a * b * c;
			else return (a + b + c - 3) * 2 + f(a - 1, b - 1, c - 1);
		}
	}.apply(null, readline().split(' ').map(Number)));
}).call(this);

;(function () {
	print(function (a, b, c) {
		return f(a, b, c);

		function f (a, b, c) {
			if (a === 1 && b === 1 && c === 1) return 1;
			if (a === 0 || b === 0 || c === 0) return 0;
			else return (a + b + c - 3) * 2 + f(a - 1, b - 1, c - 1);
		}
	}.apply(null, readline().split(' ').map(Number)));
}).call(this);

;(function () {
	print(function (a, b, c) {
		var min = Math.min(a, b, c),
			max = Math.max(a, b, c),
			mid = a + b + c - min - max;

		return (a + b + c - 3) * 2 + (max - 1) * (mid - 1);
	}.apply(null, readline().split(' ').map(Number)));
}).call(this);

;(function () {
	print(function (a, b, c) {
		var min = Math.min(a, b, c),
			max = Math.max(a, b, c),
			mid = a + b + c - min - max;

		return a * b * c - min * mid;
	}.apply(null, readline().split(' ').map(Number)));
}).call(this);


The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good:    Elements of the main diagonal.   Elements of the secondary diagonal.   Elements of the "middle" row — the row which has exactly  rows above it and the same number of rows below it.   Elements of the "middle" column — the column that has exactly  columns to the left of it and the same number of columns to the right of it.    The figure shows a 5 × 5 matrix.   The good elements are marked with green.  Help the Smart Beaver count the sum of good elements of the given matrix.

The first line of input data contains a single odd integer n. Each of the next n lines contains n integers aij (0 ≤ aij ≤ 100) separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are:    1 ≤ n ≤ 5  The input limitations for getting 100 points are:   1 ≤ n ≤ 101

Print a single integer — the sum of good matrix elements.

NoteIn the first sample all matrix elements will be good. Good elements in the second sample are shown on the figure.

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
const arr = [];

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    return;
  }

  arr.push(d.split(' ').map(Number));

  c++;
});

rl.on('close', () => {
  let ans = 0;
  let n = arr.length;

  for (let i = 0; i < arr.length; i++) {
    for (let j = 0; j < arr.length; j++) {
      if (i == j || i == Math.floor(n / 2) || j == Math.floor(n / 2) || i + j == n-1) {
        ans += arr[i][j];
      }
    }
  }

  console.log(ans);
});

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
const arr = [];

rl.on('line', (d) => {
  if (c === 0) {
    c++;
    return;
  }

  arr.push(d.split(' ').map(Number));

  c++;
});

rl.on('close', () => {
  let ans = 0;

  for (let i = 0; i < arr.length; i++) {
    for (let j = 0; j < arr.length; j++) {
      ans += arr[i][j];
    }
  }

  if (arr.length > 3) {
    ans -= arr[0][1];
    ans -= arr[0][arr.length - 2];
    ans -= arr[arr.length - 1][1];
    ans -= arr[arr.length - 1][arr.length - 2];
    ans -= arr[1][0];
    ans -= arr[1][arr.length - 1];
    ans -= arr[arr.length - 2][0];
    ans -= arr[arr.length - 2][arr.length - 1];
  }

  console.log(ans);
});

'use strict';

/*let input = `5
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1`.split('\n');
function print(output) {
	console.log(output);
}
function readline() {
	return input.shift();
}*/

//code

var n = Number(readline());
var matrix = [];
for (var i = 0; i < n; i++) {
	matrix.push(readline().split(' ').map(Number));
}
var sum = 0;
//main diag
for (var i = 0; i < n; i++) {
	sum += matrix[i][i];
}
//sec diag
for (var i = 0; i < n; i++) {
	sum += matrix[i][n - i - 1];
}
//mid row
for (var i = 0; i < n; i++) {
	sum += matrix[(n - 1) / 2][i];
}
//mid col
for (var i = 0; i < n; i++) {
	sum += matrix[i][(n - 1) / 2];
}
//sub
sum -= matrix[(n - 1) / 2][(n - 1) / 2] * 3;
print(sum);

n = parseInt(readline())
s = 0
for (i = 0; i < n; i++) {
	a = readline().split(' ').map(Number)
	for (j = 0; j < n; j++) {
		if (i==j||i+j==n-1||i==Math.floor(n/2)||j==Math.floor(n/2)) s += a[j]
	}
}
print(s)


Iahub and his friend Floyd have started painting a wall. Iahub is painting the wall red and Floyd is painting it pink. You can consider the wall being made of a very large number of bricks, numbered 1, 2, 3 and so on. Iahub has the following scheme of painting: he skips x - 1 consecutive bricks, then he paints the x-th one. That is, he'll paint bricks x, 2·x, 3·x and so on red. Similarly, Floyd skips y - 1 consecutive bricks, then he paints the y-th one. Hence he'll paint bricks y, 2·y, 3·y and so on pink.After painting the wall all day, the boys observed that some bricks are painted both red and pink. Iahub has a lucky number a and Floyd has a lucky number b. Boys wonder how many bricks numbered no less than a and no greater than b are painted both red and pink. This is exactly your task: compute and print the answer to the question.

The input will have a single line containing four integers in this order: x, y, a, b. (1 ≤ x, y ≤ 1000, 1 ≤ a, b ≤ 2·109, a ≤ b).

Output a single integer — the number of bricks numbered no less than a and no greater than b that are painted both red and pink.

NoteLet's look at the bricks from a to b (a = 6, b = 18). The bricks colored in red are numbered 6, 8, 10, 12, 14, 16, 18. The bricks colored in pink are numbered 6, 9, 12, 15, 18. The bricks colored in both red and pink are numbered with 6, 12 and 18.

function gcd(a, b){
	return a%b===0 ? b : gcd(b, a%b);
}
print(function(x, y, a, b){
	var ans = x*y/gcd(x, y);
	return Math.floor(b/ans)-Math.floor((a-1)/ans);
}.apply(0, readline().split(' ').map(Number)));

function gcd(a, b){
	return b===0 ? a : gcd(b, a%b);
}
print(function(x, y, a, b){
	var ans = x*y/gcd(x, y);
	return Math.floor(b/ans)-Math.floor((a-1)/ans);
}.apply(0, readline().split(' ').map(Number)));

function gcd (a, b) { return a ? gcd(b%a, a) : b; }
function lcm (a, b) { return a * b / gcd(a, b); }

;(function () {

	var x = readline().split(' ');
	var y = +x[1];
	var a = +x[2];
	var b = +x[3];
	x = +x[0];

	var l = lcm(x, y);

	print( Math.floor( b / l) - Math.floor( (a - 1) / l) );

}).call(this);

function gcd(a, b) {
    return b == 0 ? a : gcd(b, a % b);
}
var inp = readline().split(' ').map(Number);
var x = inp[0], y = inp[1], a = inp[2], b = inp[3];
var i = 1, g = gcd(Math.max(x, y), Math.min(x, y)), lcm = (x / g) * y;
print(Math.floor(b / lcm) - Math.floor((a - 1) / lcm));

var input = readline().split(' ').map(Number);
var x = input[0], y = input[1], a = input[2], b = input[3];
var i = 1, lcm = 0;
while (true) {
    if (x * i % y == 0) {
        lcm = x * i;
        break;
    }
    i++;
}
var cm = 0;
for (var i = a; i <= b; i++) {
    if (i % lcm === 0) {
        cm = i;
        break;
    }
}
print(cm == 0 ? 0 : Math.floor((b - Math.max(cm, a)) / lcm + 1));

var input = readline().split(' ').map(Number);
var x = input[0], y = input[1], a = input[2], b = input[3];
var i = 1, lcm = 0;
while (true) {
    if (x * i % y == 0) {
        lcm = x * i;
        break;
    }
    i++;
}
var cm = 0;
for (var i = a; i < b; i++) {
    if (i % lcm == 0) {
        cm = i;
        break;
    }
}
print(cm == 0 ? 0 : Math.floor((b - cm) / lcm + 1));

var input = readline().split(' ').map(Number);
var x = input[0], y = input[1], a = input[2], b = input[3];
var i = 1, lcm = 0;
while (true) {
    if (x * i % y == 0) {
        lcm = x * i;
        break;
    }
    i++;
}
var cm = 0;
for (var i = a; i < b; i++) {
    if (i % lcm == 0) {
        cm = i;
        break;
    }
}
print(cm == 0 || Math.floor((b - cm) / lcm + 1));

var input = readline().split(' ').map(Number);
var x = input[0], y = input[1], a = input[2], b = input[3];
var i = 1, lcm = 0;
while (true) {
    if (x * i % y == 0) {
        lcm = x * i;
        break;
    }
    i++;
}
var cm = lcm;
for (var i = a; i < b; i++) {
    if (i % lcm == 0) {
        cm = i;
        break;
    }
}
print(Math.floor((b - Math.max(cm, a)) / lcm + 1));

var input = readline().split(' ').map(Number);
var x = input[0], y = input[1], a = input[2], b = input[3];
var i = 1, lcm = 0;
while (true) {
    if (x * i % y == 0) {
        lcm = x * i;
        break;
    }
    i++;
}
var cm = 0;
for (var i = a; i < b; i++) {
    if (i % lcm == 0) {
        cm = i;
        break;
    }
}
print(cm == 0 || (b - cm) / lcm + 1);

var input = readline().split(' ').map(Number);
var x = input[0], y = input[1], a = input[2], b = input[3];
var i = 1, lcm = 0;
while (true) {
    if (x * i % y == 0) {
        lcm = x * i;
        break;
    }
    i++;
}
var cm = lcm;
for (var i = a; i < b; i++) {
    if (i % lcm == 0) {
        cm = i;
        break;
    }
}
print(Math.floor((b - cm) / lcm + 1));


Kavi has $$$2n$$$ points lying on the $$$OX$$$ axis, $$$i$$$-th of which is located at $$$x = i$$$.Kavi considers all ways to split these $$$2n$$$ points into $$$n$$$ pairs. Among those, he is interested in good pairings, which are defined as follows:Consider $$$n$$$ segments with ends at the points in correspondent pairs. The pairing is called good, if for every $$$2$$$ different segments $$$A$$$ and $$$B$$$ among those, at least one of the following holds:  One of the segments $$$A$$$ and $$$B$$$ lies completely inside the other.  $$$A$$$ and $$$B$$$ have the same length. Consider the following example:  $$$A$$$ is a good pairing since the red segment lies completely inside the blue segment.$$$B$$$ is a good pairing since the red and the blue segment have the same length.$$$C$$$ is not a good pairing since none of the red or blue segments lies inside the other, neither do they have the same size.Kavi is interested in the number of good pairings, so he wants you to find it for him. As the result can be large, find this number modulo $$$998244353$$$.Two pairings are called different, if some two points are in one pair in some pairing and in different pairs in another.

The single line of the input contains a single integer $$$n$$$ $$$(1\le n \le 10^6)$$$.

Print the number of good pairings modulo $$$998244353$$$.

NoteThe good pairings for the second example are:   In the third example, the good pairings are:

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

const MOD = 998244353;

function main () {
	const n = rn();

	const dp = Array(n + 1).fill(0);
	for (let i = 1; i <= n; i++) {
		for (let j = i; j <= n; j += i) {
			dp[j]++;
		}
	}

	for (let i = 1, psm = 0; i <= n ; i++) {
		dp[i] += psm;
		psm = (psm + dp[i]) % MOD;
	}

	console.log(dp[n]);
}

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var l = 0;
    console.log(solve(+lines[l++]))
});

function solve(n) {
    const dp = Array(n + 1).fill(0)
    for (let i = 1; i < n; i++) {
        for (let j = i + i; j <= n; j += i) {
            dp[j]++
        }
    }
    let sum = 1
    for (let i = 1; i <= n; i++) {
        dp[i] = add(dp[i], sum)
        sum = add(sum, dp[i])
    }
    return dp[n]
}

function add(a, b) {
    return (a + b) % 998244353
}


JATC and his friend Giraffe are currently in their room, solving some problems. Giraffe has written on the board an array $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ of integers, such that $$$1 \le a_1 < a_2 < \ldots < a_n \le 10^3$$$, and then went to the bathroom.JATC decided to prank his friend by erasing some consecutive elements in the array. Since he doesn't want for the prank to go too far, he will only erase in a way, such that Giraffe can still restore the array using the information from the remaining elements. Because Giraffe has created the array, he's also aware that it's an increasing array and all the elements are integers in the range $$$[1, 10^3]$$$.JATC wonders what is the greatest number of elements he can erase?

The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the array. The second line of the input contains $$$n$$$ integers $$$a_i$$$ ($$$1 \le a_1<a_2<\dots<a_n \le 10^3$$$) — the array written by Giraffe.

Print a single integer — the maximum number of consecutive elements in the array that JATC can erase. If it is impossible to erase even a single element, print $$$0$$$.

NoteIn the first example, JATC can erase the third and fourth elements, leaving the array $$$[1, 3, \_, \_, 6, 9]$$$. As you can see, there is only one way to fill in the blanks.In the second example, JATC can erase the second and the third elements. The array will become $$$[998, \_, \_]$$$. Because all the elements are less than or equal to $$$1000$$$, the array is still can be restored. Note, that he can't erase the first $$$2$$$ elements.In the third example, JATC can erase the first $$$4$$$ elements. Since all the elements are greater than or equal to $$$1$$$, Giraffe can still restore the array. Note, that he can't erase the last $$$4$$$ elements.

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
rl.on('line', (input) => {
    if (l === 0) { l++ }
    else {
        rl.close();
        let arr = input.split(" ").map(x => parseInt(x))
        let cnt = 0
        let max = 0
        for (let i = 1; i < arr.length; i++) {
            if (arr[i]===arr[i-1]+1) {
                cnt++
                if(i===1 && arr[i-1]===1){
                    cnt++
                }
                if(i+1<arr.length&&arr[i]+1!==arr[i+1]){
                    cnt--
                }
                if(i===arr.length-1 && arr[i]!==1000){
                    cnt--
                }
                if(cnt>max){
                    max=cnt
                }
            } else {
                cnt=0
            }
        }
        console.log(max)
        return 0;
    }
})

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let standardInputString= '';
let currentLine = 0;

function readLine(){
  return standardInputString[currentLine++];
}

process.stdin.on('data', rawData =>{
  standardInputString += rawData;
});

process.stdin.on('end', _ =>{
  standardInputString= standardInputString.trim().split('\n').map(line =>{
    return line.trim();
  });

  main();
})

function main(){
    let [n] = readLine().split(' ').map(Number);

   let line = readLine().split(' ').map(Number);

    let consecutives = 0;

  let result = 0;
  line.unshift(0);
  line.push(1001);

    for(let i =1; i<=n; i++){
      if(line[i]-1 ===line[i-1]&& line[i+1] -1 === line[i]){
        consecutives++;
      }
      else{
        consecutives = 0;
      }
      result = Math.max(result, consecutives);
    }
    console.log(result);
  }

var n = readline();
var a = readline().split(' ');
function prank(n,array){
    var a = [0];
    var index,length=1,max=1;
    a = a.concat(array).concat(1001);
    for(var i= 1; i<a.length; i++){
        if((a[i]-a[i-1])==1){
            length++;
            if(length > max){max = length;}
        }else{
            length = 1;
        }
    }
    var ans=0;
    if (max-2>ans) ans=max-2;
    return ans;
}

print(prank(n,a));

var maxRes = 0, res = 0;
readline();

var arr = ('0 ' + readline() + ' 1001').split(' ');
for(var i = 2; i < arr.length; i++) {
    if(arr[i] - arr[i-2] === 2) maxRes = Math.max(maxRes, ++res); else res = 0;
}

if(maxRes === arr.length - 2) maxRes--;

print(maxRes);

readline();var gp = [];var m = 0;var sd = "s";var input = readline().split(' ');

for (var i = 0; i < input.length - 1; i++){

if(Math.abs(input[i] - input[(1+i)]) == 1){m++;if(sd=="s"){sd=i;}}

else
{
if((input[sd] == 1)||(input[i] == 1000)){gp.push(m);}else{gp.push(m-1);}
m=0;sd="s";
}

}if((input[sd] == 1)||(input[input.length - 1] == 1000)){gp.push(m);}else{gp.push(m-1);}m=0;sd="s";

print(Math.max(...gp) > 0 ? Math.max(...gp) : 0 );

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let standardInputString= '';
let currentLine = 0;

function readLine(){
  return standardInputString[currentLine++];
}

process.stdin.on('data', rawData =>{
  standardInputString += rawData;
});

process.stdin.on('end', _ =>{
  standardInputString= standardInputString.trim().split('\n').map(line =>{
    return line.trim();
  });

  main();
})

function main(){
    let [n] = readLine().split(' ').map(Number);

   let line = readLine().split(' ').map(Number);

  let d = 0;
  let isFirstOrLast = false;
    let consecutives = 1;

    let result;
    for(let i =0; i<n; i++){
      d = line[i] - line[i-1];
      let prevConsecutive = consecutives;
      // console.log(d);
      if(d === 1){
        consecutives++;
        if(line[i-1] === 1 || line[i] === 1000){
          isFirstOrLast = true;
        }
      }
      else{
        prevConsecutive = consecutives

        if(prevConsecutive > consecutives){
          result = prevConsecutive;
        }
        else{
          result = consecutives;
        }
        consecutives = 1;
      }

    }
    if(result === n){
      result -= 1;
    }
    else if(isFirstOrLast){
      result = result / 2 +1;
    }
    else{
      result /= 2;
    }
  console.log(result);

  }

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let standardInputString= '';
let currentLine = 0;

function readLine(){
  return standardInputString[currentLine++];
}

process.stdin.on('data', rawData =>{
  standardInputString += rawData;
});

process.stdin.on('end', _ =>{
  standardInputString= standardInputString.trim().split('\n').map(line =>{
    return line.trim();
  });

  main();
})

function main(){
    let [n] = readLine().split(' ').map(Number);

   let line = readLine().split(' ').map(Number);

  let d = 0;
  let isFirstOrLast = false;
    let consecutives = 1;

    let result;
    for(let i =0; i<n; i++){
      d = line[i] - line[i-1];
      let prevConsecutive = consecutives;
      // console.log(d);
      if(d === 1){
        consecutives++;
        if(line[i-1] === 1 || line[i] === 1000){
          isFirstOrLast = true;
        }
        result = consecutives;
      }
      else{
        prevConsecutive = consecutives

        if(prevConsecutive > consecutives){
          result = prevConsecutive;
        }
        else{
          result = consecutives;
        }
        consecutives = 1;
      }

    }
    if(result === n){
      result -= 1;
    }
    else if(isFirstOrLast){
      result = result / 2 +1;
    }
    else if(Math.ceil(result === 3)){
      result = 1;
    }
    else{
      result /= 2;
    }
  console.log(Math.ceil(result));

  }

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let standardInputString= '';
let currentLine = 0;

function readLine(){
  return standardInputString[currentLine++];
}

process.stdin.on('data', rawData =>{
  standardInputString += rawData;
});

process.stdin.on('end', _ =>{
  standardInputString= standardInputString.trim().split('\n').map(line =>{
    return line.trim();
  });

  main();
})

function main(){
    let [n] = readLine().split(' ').map(Number);

   let line = readLine().split(' ').map(Number);

  let d = 0;
  let isFirstOrLast = false;
    let consecutives = 1;
    for(let i =0; i<n; i++){
      d = line[i] - line[i-1];

      if(d === 1){
        consecutives++;
        if(line[i-1] === 1 || line[i] === 1000){
          isFirstOrLast = true;
        }
      }
      d = 0;
    }
    if(consecutives === n){
      consecutives -= 1;
    }
    else if(isFirstOrLast){
      consecutives = consecutives / 2 +1;
    }
    else{
      consecutives /= 2;
    }

  console.log(consecutives);
  }

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let standardInputString= '';
let currentLine = 0;

function readLine(){
  return standardInputString[currentLine++];
}

process.stdin.on('data', rawData =>{
  standardInputString += rawData;
});

process.stdin.on('end', _ =>{
  standardInputString= standardInputString.trim().split('\n').map(line =>{
    return line.trim();
  });

  main();
})

function main(){
    let [n] = readLine().split(' ').map(Number);

   let line = readLine().split(' ').map(Number);

  let d = 0;
  let isFirstOrLast = false;
    let consecutives = 1;

    let result =1;

    let prev = 1;

    for(let i =0; i<n; i++){

      d = line[i] - line[i-1];

      if(d === 1){
        consecutives++;
        if(line[i-1] === 1 || line[i] === 1000){
          isFirstOrLast = true;
        }
        if(prev <= consecutives){
          prev = consecutives;
          result = prev;
        }

      }
      else{
        consecutives = 1;
      }

    }
    if(isFirstOrLast){

      result = (result - 2) +1;
    }

    else if(Math.ceil(result === 3)){
      result = 1;
    }
    else if(result ===1){
      result = 0;
    }
    else if(result === 2){
      result = 0;
    }

    else{
      result -= 2;
    }
    console.log(result);
  }

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let standardInputString= '';
let currentLine = 0;

function readLine(){
  return standardInputString[currentLine++];
}

process.stdin.on('data', rawData =>{
  standardInputString += rawData;
});

process.stdin.on('end', _ =>{
  standardInputString= standardInputString.trim().split('\n').map(line =>{
    return line.trim();
  });

  main();
})

function main(){
    let [n] = readLine().split(' ').map(Number);

   let line = readLine().split(' ').map(Number);

  let d = 0;
  let isFirstOrLast = false;
    let consecutives = 1;

    let result =1;

    let prev = 1;

    for(let i =0; i<n; i++){

      d = line[i] - line[i-1];

      if(d === 1){
        consecutives++;
        if(line[i-1] === 1 || line[i] === 1000){
          isFirstOrLast = true;
        }
        if(prev <= consecutives){
          prev = consecutives;
          result = prev;
        }

      }
      else{
        isFirstOrLast = false;
        consecutives = 1;
      }
    }
    if(isFirstOrLast){

      result = (result - 2) +1;
    }

    // else if(result === 3){
    //   result = 1;
    // }
    else if(result ===1){
      result = 0;
    }
    else if(result === 2){
      result = 0;
    }

    else{
      result -= 2;
    }
    console.log(result);
  }

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let standardInputString= '';
let currentLine = 0;

function readLine(){
  return standardInputString[currentLine++];
}

process.stdin.on('data', rawData =>{
  standardInputString += rawData;
});

process.stdin.on('end', _ =>{
  standardInputString= standardInputString.trim().split('\n').map(line =>{
    return line.trim();
  });

  main();
})

function main(){
    let [n] = readLine().split(' ').map(Number);

   let line = readLine().split(' ').map(Number);

  let d = 0;
  let isFirstOrLast = false;
    let consecutives = 1;

    let result;
    for(let i =0; i<n; i++){
      d = line[i] - line[i-1];
      let prevConsecutive = consecutives;
      // console.log(d);
      if(d === 1){
        consecutives++;
        if(line[i-1] === 1 || line[i] === 1000){
          isFirstOrLast = true;
        }
        result = consecutives;
      }
      else{
        prevConsecutive = consecutives

        if(prevConsecutive > consecutives){
          result = prevConsecutive;
        }
        else{
          result = consecutives;
        }
        consecutives = 1;
      }

    }
    if(result === n){
      result -= 1;
    }
    else if(isFirstOrLast){
      result = result / 2 +1;
    }
    else if(Math.ceil(result === 3)){
      result = 1;
    }
    else if(result ===1){
      result = 0;
    }
    else{
      result /= 2;
    }
  console.log(Math.ceil(result));

  }

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let standardInputString= '';
let currentLine = 0;

function readLine(){
  return standardInputString[currentLine++];
}

process.stdin.on('data', rawData =>{
  standardInputString += rawData;
});

process.stdin.on('end', _ =>{
  standardInputString= standardInputString.trim().split('\n').map(line =>{
    return line.trim();
  });

  main();
})

function main(){
    let [n] = readLine().split(' ').map(Number);

   let line = readLine().split(' ').map(Number);

  let d = 0;
  let isFirstOrLast = false;
    let consecutives = 1;

    let result;

    let prev = 1;

    for(let i =0; i<n; i++){

      d = line[i] - line[i-1];

      if(d === 1){
        consecutives++;
        if(line[i-1] === 1 || line[i] === 1000){
          isFirstOrLast = true;
        }
        if(prev <= consecutives){
          prev = consecutives;
          result = prev;
        }

      }
      else{
        consecutives = 1;
      }

    }
    if(result === n){
      result -= 1;
    }
    else if(isFirstOrLast){
      result = result / 2 +1;
    }
    else if(Math.ceil(result === 3)){
      result = 1;
    }
    else if(result ===1){
      result = 0;
    }
    else{
      result -= 2;
    }
    console.log(result);
  }

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let standardInputString= '';
let currentLine = 0;

function readLine(){
  return standardInputString[currentLine++];
}

process.stdin.on('data', rawData =>{
  standardInputString += rawData;
});

process.stdin.on('end', _ =>{
  standardInputString= standardInputString.trim().split('\n').map(line =>{
    return line.trim();
  });

  main();
})

function main(){
    let [n] = readLine().split(' ').map(Number);

   let line = readLine().split(' ').map(Number);

    let consecutives = 0;

  let result = 0;

    for(let i =1; i<=n; i++){
      if(line[i]-1 ===line[i-1]&& line[i+1] -1 === line[i]){
        consecutives++;
      }
      else{
        consecutives = 0;
      }
      result = Math.max(result, consecutives);
    }
    console.log(result)
  }

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let standardInputString= '';
let currentLine = 0;

function readLine(){
  return standardInputString[currentLine++];
}

process.stdin.on('data', rawData =>{
  standardInputString += rawData;
});

process.stdin.on('end', _ =>{
  standardInputString= standardInputString.trim().split('\n').map(line =>{
    return line.trim();
  });

  main();
})

function main(){
    let [n] = readLine().split(' ').map(Number);

   let line = readLine().split(' ').map(Number);

  let d = 0;
  let isFirstOrLast = false;
    let consecutives = 1;

    let result =1;

    let prev = 1;

    for(let i =0; i<n; i++){

      d = line[i] - line[i-1];

      if(d === 1){
        consecutives++;
        if(line[i-1] === 1 || line[i] === 1000){
          isFirstOrLast = true;
        }
        if(prev <= consecutives){
          prev = consecutives;
          result = prev;
        }

      }
      else{
        consecutives = 1;
      }

    }
    if(result === n && result !== 2){
      result -= 1;
    }
    else if(isFirstOrLast){
      result = result / 2 +1;
    }
    else if(Math.ceil(result === 3)){
      result = 1;
    }
    else if(result ===1){
      result = 0;
    }
    else if(result === 2){
      result = 0;
    }
    else{
      result -= 2;
    }
    console.log(result);
  }

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let standardInputString= '';
let currentLine = 0;

function readLine(){
  return standardInputString[currentLine++];
}

process.stdin.on('data', rawData =>{
  standardInputString += rawData;
});

process.stdin.on('end', _ =>{
  standardInputString= standardInputString.trim().split('\n').map(line =>{
    return line.trim();
  });

  main();
})

function main(){
    let [n] = readLine().split(' ').map(Number);

   let line = readLine().split(' ').map(Number);

  let d = 0;
  let isFirstOrLast = false;
    let consecutives = 1;

    let result =1;

    let prev = 1;

    for(let i =0; i<n; i++){

      d = line[i] - line[i-1];

      if(d === 1){
        consecutives++;
        if(line[i-1] === 1 || line[i] === 1000){
          isFirstOrLast = true;
        }
        if(prev <= consecutives){
          prev = consecutives;
          result = prev;
        }

      }
      else{
        consecutives = 1;
      }

    }
    if(isFirstOrLast){

      result = (result - 2) +1;
    }

    else if(Math.ceil(result === 3)){
      result = 1;
    }
    else if(result ===1){
      result = 0;
    }
    else if(result === 2){
      result = 0;
    }
    else if(result === n){
      result = 0;
    }
    else{
      result -= 2;
    }
    console.log(result);
  }

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let standardInputString= '';
let currentLine = 0;

function readLine(){
  return standardInputString[currentLine++];
}

process.stdin.on('data', rawData =>{
  standardInputString += rawData;
});

process.stdin.on('end', _ =>{
  standardInputString= standardInputString.trim().split('\n').map(line =>{
    return line.trim();
  });

  main();
})

function main(){
    let [n] = readLine().split(' ').map(Number);

   let line = readLine().split(' ').map(Number);

  let d = 0;
  let isFirstOrLast = false;
    let consecutives = 1;

    let result;
    for(let i =0; i<n; i++){
      d = line[i] - line[i-1];
      let prevConsecutive = consecutives;
      // console.log(d);
      if(d === 1){
        consecutives++;
        if(line[i-1] === 1 || line[i] === 1000){
          isFirstOrLast = true;
        }
        result = consecutives;
      }
      else{
        prevConsecutive = consecutives

        if(prevConsecutive > consecutives){
          result = prevConsecutive;
        }
        else{
          result = consecutives;
        }
        consecutives = 1;
      }

    }
    if(result === n){
      result -= 1;
    }
    else if(isFirstOrLast){
      result = result / 2 +1;
    }
    else{
      result /= 2;
    }
  console.log(result);

  }

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let standardInputString= '';
let currentLine = 0;

function readLine(){
  return standardInputString[currentLine++];
}

process.stdin.on('data', rawData =>{
  standardInputString += rawData;
});

process.stdin.on('end', _ =>{
  standardInputString= standardInputString.trim().split('\n').map(line =>{
    return line.trim();
  });

  main();
})

function main(){
    let [n] = readLine().split(' ').map(Number);

   let line = readLine().split(' ').map(Number);

  let d = 0;
  let isFirstOrLast = false;
    let consecutives = 1;

    let result =1;

    let prev = 1;

    for(let i =0; i<n; i++){

      d = line[i] - line[i-1];

      if(d === 1){
        consecutives++;
        if(line[i-1] === 1 || line[i] === 1000){
          isFirstOrLast = true;
        }
        if(prev <= consecutives){
          prev = consecutives;
          result = prev;
        }

      }
      else{
        consecutives = 1;
      }

    }
    if(result === n){
      result -= 1;
    }
    else if(isFirstOrLast){
      result = result / 2 +1;
    }
    else if(Math.ceil(result === 3)){
      result = 1;
    }
    else if(result ===1){
      result = 0;
    }
    else{
      result -= 2;
    }
    console.log(result);
  }

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let standardInputString= '';
let currentLine = 0;

function readLine(){
  return standardInputString[currentLine++];
}

process.stdin.on('data', rawData =>{
  standardInputString += rawData;
});

process.stdin.on('end', _ =>{
  standardInputString= standardInputString.trim().split('\n').map(line =>{
    return line.trim();
  });

  main();
})

function main(){
    let [n] = readLine().split(' ').map(Number);

   let line = readLine().split(' ').map(Number);

  let d = 0;
  let isFirstOrLast = false;
    let consecutives = 1;

    let result =1;

    let prev = 1;

    for(let i =0; i<n; i++){

      d = line[i] - line[i-1];

      if(d === 1){
        consecutives++;
        if(line[i-1] === 1 || line[i] === 1000){
          isFirstOrLast = true;
        }
        if(prev <= consecutives){
          prev = consecutives;
          result = prev;
        }

      }
      else{
        consecutives = 1;
      }

    }
    if(result === n){
      result -= 1;
    }
    else if(isFirstOrLast){
      result = result / 2 +1;
    }
    else if(Math.ceil(result === 3)){
      result = 1;
    }
    else if(result ===1){
      result = 0;
    }
    else if(result === 2){
      result = 1;
    }
    else{
      result -= 2;
    }
    console.log(result);
  }

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let standardInputString= '';
let currentLine = 0;

function readLine(){
  return standardInputString[currentLine++];
}

process.stdin.on('data', rawData =>{
  standardInputString += rawData;
});

process.stdin.on('end', _ =>{
  standardInputString= standardInputString.trim().split('\n').map(line =>{
    return line.trim();
  });

  main();
})

function main(){
    let [n] = readLine().split(' ').map(Number);

   let line = readLine().split(' ').map(Number);

  let d = 0;
  let isFirstOrLast = false;
    let consecutives = 1;

    let result =1;

    let prev = 1;

    for(let i =0; i<n; i++){

      d = line[i] - line[i-1];

      if(d === 1){
        consecutives++;
        if(line[i-1] === 1 || line[i] === 1000){
          isFirstOrLast = true;
        }
        if(prev <= consecutives){
          prev = consecutives;
          result = prev;
        }
        else{
          isFirstOrLast = true;
        }
      }
      else{
        isFirstOrLast = false;
        consecutives = 1;
      }
    }
    if(isFirstOrLast){

      result = (result - 2) +1;
    }

    // else if(result === 3){
    //   result = 1;
    // }
    else if(result ===1){
      result = 0;
    }
    else if(result === 2){
      result = 0;
    }

    else{
      result -= 2;
    }
    console.log(result);
  }

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let standardInputString= '';
let currentLine = 0;

function readLine(){
  return standardInputString[currentLine++];
}

process.stdin.on('data', rawData =>{
  standardInputString += rawData;
});

process.stdin.on('end', _ =>{
  standardInputString= standardInputString.trim().split('\n').map(line =>{
    return line.trim();
  });

  main();
})

function main(){
    let [n] = readLine().split(' ').map(Number);

   let line = readLine().split(' ').map(Number);

  let d = 0;
  let isFirstOrLast = false;
    let consecutives = 1;

    let result =1;

    let prev = 1;

    for(let i =0; i<n; i++){

      d = line[i] - line[i-1];

      if(d === 1){
        consecutives++;
        if(line[i-1] === 1 || line[i] === 1000){
          isFirstOrLast = true;
        }
        if(prev <= consecutives){
          prev = consecutives;
          result = prev;
        }

      }
      else{
        consecutives = 1;
      }

    }
    if(isFirstOrLast){

      result = (result - 2) +1;
    }
    else if(result === n){
      result = 0;
    }
    else if(Math.ceil(result === 3)){
      result = 1;
    }
    else if(result ===1){
      result = 0;
    }
    else if(result === 2){
      result = 0;
    }
    else{
      result -= 2;
    }
    console.log(result);
  }

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let standardInputString= '';
let currentLine = 0;

function readLine(){
  return standardInputString[currentLine++];
}

process.stdin.on('data', rawData =>{
  standardInputString += rawData;
});

process.stdin.on('end', _ =>{
  standardInputString= standardInputString.trim().split('\n').map(line =>{
    return line.trim();
  });

  main();
})

function main(){
    let [n] = readLine().split(' ').map(Number);

   let line = readLine().split(' ').map(Number);

    let consecutives = 0;

  let result = 0;
  line.unshift(1);
  line.push(1001);

    for(let i =1; i<=n; i++){
      if(line[i]-1 ===line[i-1]&& line[i+1] -1 === line[i]){
        consecutives++;
      }
      else{
        consecutives = 0;
      }
      result = Math.max(result, consecutives);
    }
    console.log(result);
  }

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
rl.on('line', (input) => {
    if (l === 0) { l++ }
    else {
        rl.close();
        let arr = input.split(" ").map(x => parseInt(x))
        let cnt = 0
        let max = -1
        for (let i = 1; i < arr.length; i++) {
            if (arr[i]===arr[i-1]+1) {
                cnt++
                if(i+1<arr.length&&arr[i]+1!==arr[i+1]){
                    cnt--
                }
                if(cnt>max){
                    max=cnt
                }
            } else {
                cnt=0
            }
        }
        console.log(max)
        return 0;
    }
})

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
rl.on('line', (input) => {
    if (l === 0) { l++ }
    else {
        rl.close();
        let arr = input.split(" ").map(x => parseInt(x))
        let cnt = 0
        let max = 0
        for (let i = 1; i < arr.length; i++) {
            if (arr[i]===arr[i-1]+1) {
                cnt++
                if(i+1<arr.length&&arr[i]+1!==arr[i+1]){
                    cnt--
                }
                if(cnt>max){
                    max=cnt
                }
            } else {
                cnt=0
            }
        }
        console.log(max)
        return 0;
    }
})

var n = readline();
var a = readline().split(' ');
function prank(n,array){
    var a = [0];
    var index,length=0,max=0;
    a = a.concat(array).concat(1001);
    for(var i= 1; i<a.length; i++){
        if((a[i]-a[i-1])==1){
            length++;
        }else{
            max = length;
            length = 0;
        }
    }
    return max-2;
}

print(prank(n,a));

var n = readline();
var a = readline().split(' ');
function prank(n,array){
    var a = [0];
    var index,length=0,max=0;
    a = a.concat(array).concat(1001);
    for(var i= 1; i<a.length; i++){
        if((a[i]-a[i-1])==1){
            length++;
        }else{
            if(length > max){max = length;}
            length = 0;
        }
    }
    return max-2;
}

print(prank(n,a));

function prank(array){
    var a = [0];
    var index,length=0,max=0;
    a = a.concat(array).concat(1001);
    for(var i= 1; i<a.length; i++){
        if((a[i]-a[i-1])==1){
            length++;
        }else{
            max = length;
            length = 0;
        }
    }
    console.log(max-2)
    return max-2;
}

var n = readline();
var a = readline().split(' ');
function prank(n,array){
    var a = [0];
    var index,length=0,max=0;
    a = a.concat(array).concat(1001);
    for(var i= 1; i<a.length; i++){
        if((a[i]-a[i-1])==1){
            length++;
        }else{
            if(length > max){max = length;}
            length = 1;
        }
    }
    var ans=0;
    if (max-2>ans) ans=max-2;
    return ans;
}

print(prank(n,a));

var res = 0;
readline();

var arr = ('0 ' + readline() + ' 1001').split(' ');
for(var i = 4; i < arr.length; i++) {
    if(arr[i] - arr[i-2] === 2) res++;
}

print(res);

var res = 0;
readline();

var arr = ('0 ' + readline() + ' 1001').split(' ');
for(var i = 2; i < arr.length; i++) {
    if(arr[i] - arr[i-2] === 2) res++;
}

print(res);

var res = 0;
readline();

var arr = ('0 ' + readline() + ' 1001').split(' ');
for(var i = 2; i < arr.length; i++) {
    if(arr[i] - arr[i-2] === 2) res++;
}

if(arr[2] - arr[0] === 2 && arr[3] - arr[1] === 2) res--;

print(res);

n = readline();input = readline().split(' ');
var gar = [];for (var i = 0; i < input.length - 1; i++){ gar.push( Math.abs( input[i] -  input[(i+1)] ) ) }

var b  = Math.min(...gar);
var bcount= 0 ;for (var i = 0; i < gar.length; i++) {if(gar[i]=="1"){bcount +=1;}}

if(bcount > 0 )
{

if(bcount == (input.length -1)){print(bcount)}
	else{
if(bcount == 1){print(bcount)}else{print(bcount - 1)}

}

}

else{print(0)};

n = readline();
var input = readline().split(' ');
var bbcount = [];var k = 0;var gar = [];

for(var i = 0; i < input.length - 1; i++){gar.push(Math.abs(input[i] - input[(i+1)]))}
for (var i = 0; i < gar.length; i++){if(gar[i]!="1"){bbcount.push(k);k=0;}else if(gar[i]=="1"){k++;}}bbcount.push(k); bbcount[0]= Math.max(...bbcount);

if(bbcount[0] > 1)
{
	if(bbcount[0] == input.length - 1){bbcount[0] +=1;}
	print(bbcount[0] - 1)
}
else
	{print("0")}

n = readline();input = readline().split(' ');

var gar = [];
for (var i = 0; i < input.length - 1; i++)
{ gar.push(Math.abs( input[i] -  input[(i+1)] ) )}

//print(gar);
var b  = Math.min(...gar);
var bcount= 0 ;for (var i = 0; i < gar.length; i++) {if(gar[i]==b){bcount +=1;}}

if(bcount > 0 )
{

if(bcount == (input.length -1)){print(bcount)}else {print(bcount - 1)}

}
else{print(0)};

readline();
var input = readline().split(' ');
var bbcount = [];var k = 0;

for(var i = 0; i < input.length - 1; i++)
{
 var r = (Math.abs(input[i] - input[(i+1)]));
 if(r == "1"){k++;} else{bbcount.push(k);k=0;}
}
bbcount.push(k);bbcount[0] = Math.max(...bbcount);

if(bbcount[0] == 1){if((input[1] == 2) ||(input[1] == 1000)){bbcount[0] +=1;}}

if(bbcount[0] > 1)
{
if(bbcount[0] == input.length - 1){bbcount[0] +=1;}
print(bbcount[0] - 1);
}else{print("0")}

n = readline();
input = readline().split(' ');

var gar = [];

for (var i = 0; i < input.length - 1; i++)
{
 gar.push(
	Math.abs(input[i] -  input[(i+1)]))
}

//print(gar);
var b  = Math.min(...gar);

var bcount= 0 ;
for (var i = 0; i < gar.length; i++) {
	if(gar[i]==b){bcount +=1;}
}

if(bcount > 1 )
{

if(bcount == (input.length -1)){print(bcount)}else {print(bcount - 1)}

}
else{print(0)};

readline();
var input = readline().split(' ');
var bbcount = [];var k = 0;

for(var i = 0; i < input.length - 1; i++)
{
 var r = (Math.abs(input[i] - input[(i+1)]));
 if(r == "1"){k++;} else{bbcount.push(k);k=0;}
}
bbcount.push(k);bbcount[0] = Math.max(...bbcount);

if((bbcount[0] == 1)&&(input[1] == 2)){bbcount[0] +=1;}
if(bbcount[0] > 1)
{
if(bbcount[0] == input.length - 1){bbcount[0] +=1;}
print(bbcount[0] - 1);
}else{print("0")}

n = readline();
var bbcount = [];var k = 0;var gar = [];
var input = readline().split(' ');

for(var i = 0; i < input.length - 1; i++){gar.push( Math.abs( input[i] - input[(i+1)]))}

var bcount= 0 ;for (var i = 0; i < gar.length; i++)
{
	if(gar[i]!="1"){bbcount.push(k);k=0;}
	else if(gar[i]=="1"){k++;}
}

bbcount.push(k);bbcount[0]= Math.max(...bbcount);

if(bbcount[0] == (input.length -1)){print(bbcount[0])}
	else{
if(bbcount[0] == 1){print(bbcount[0])}else{print(bbcount[0] - 1)}

}

n = readline();input = readline().split(' ');
var gar = [];for (var i = 0; i < input.length - 1; i++){ gar.push( Math.abs( input[i] -  input[(i+1)] ) ) }

var bcount= 0 ;for (var i = 0; i < gar.length; i++)
{
	if((bcount>0)&&(gar[i]!="1")){i = gar.length}else{
		if(gar[i]=="1"){bcount +=1;}
	}

}

if(bcount > 0 )
{

if(bcount == (input.length -1)){print(bcount)}
	else{
if(bcount == 1){print(bcount)}else{print(bcount - 1)}

}

}

else{print(0)};

n = readline();
var bbcount = [];var k = 0;var gar = [];
var input = readline().split(' ');

for(var i = 0; i < input.length - 1; i++){gar.push( Math.abs( input[i] - input[(i+1)]))}

var bcount= 0 ;for (var i = 0; i < gar.length; i++)
{
	if(gar[i]!="1"){bbcount.push(k);k=0;}
	else if(gar[i]=="1"){k++;}
}

bbcount.push(k);bbcount[0]= Math.max(...bbcount);

var calc = 0
if(bbcount[0] == (input.length -1)){calc = (bbcount[0])}
	else{
if(bbcount[0] == 1){calc = (bbcount[0])}else{calc = (bbcount[0] - 1)}

}

if(calc > 0){print(calc)}else{print("0")}

n = readline();input = readline().split(' ');

var gar = [];
for (var i = 0; i < input.length - 1; i++)
{ gar.push( Math.abs( input[i] -  input[(i+1)] ) ) }

//print(gar);
var b  = Math.min(...gar);
var bcount= 0 ;for (var i = 0; i < gar.length; i++) {if(gar[i]=="1"){bcount +=1;}}

if(bcount > 0 )
{

if(bcount == (input.length -1)){print(bcount)}else {print(bcount - 1)}

}
else{print(0)};

n = readline();
input = readline().split(' ');
//1 3 4 5 7 9
var gar = [];

for (var i = 0; i < input.length - 1; i++)
{
 gar.push(
	Math.abs(input[i] -  input[(i+1)]))
}

var b  = Math.min(...gar);

var bcount= 0 ;
for (var i = 0; i < gar.length; i++) {
	if(gar[i]==b){bcount +=1;}
}

if(bcount > 1 ){print(bcount)}else{print(0)};