There are $$$n$$$ models in the shop numbered from $$$1$$$ to $$$n$$$, with sizes $$$s_1, s_2, \ldots, s_n$$$.Orac will buy some of the models and will arrange them in the order of increasing numbers (i.e. indices, but not sizes).Orac thinks that the obtained arrangement is beatiful, if for any two adjacent models with indices $$$i_j$$$ and $$$i_{j+1}$$$ (note that $$$i_j < i_{j+1}$$$, because Orac arranged them properly), $$$i_{j+1}$$$ is divisible by $$$i_j$$$ and $$$s_{i_j} < s_{i_{j+1}}$$$.For example, for $$$6$$$ models with sizes $$$\{3, 6, 7, 7, 7, 7\}$$$, he can buy models with indices $$$1$$$, $$$2$$$, and $$$6$$$, and the obtained arrangement will be beautiful. Also, note that the arrangement with exactly one model is also considered beautiful.Orac wants to know the maximum number of models that he can buy, and he may ask you these queries many times.

The first line contains one integer $$$t\ (1 \le t\le 100)$$$: the number of queries. Each query contains two lines. The first line contains one integer $$$n\ (1\le n\le 100\,000)$$$: the number of models in the shop, and the second line contains $$$n$$$ integers $$$s_1,\dots,s_n\ (1\le s_i\le 10^9)$$$: the sizes of models. It is guaranteed that the total sum of $$$n$$$ is at most $$$100\,000$$$.

Print $$$t$$$ lines, the $$$i$$$-th of them should contain the maximum number of models that Orac can buy for the $$$i$$$-th query.

NoteIn the first query, for example, Orac can buy models with indices $$$2$$$ and $$$4$$$, the arrangement will be beautiful because $$$4$$$ is divisible by $$$2$$$ and $$$6$$$ is more than $$$3$$$. By enumerating, we can easily find that there are no beautiful arrangements with more than two models. In the second query, Orac can buy models with indices $$$1$$$, $$$3$$$, and $$$6$$$. By enumerating, we can easily find that there are no beautiful arrangements with more than three models. In the third query, there are no beautiful arrangements with more than one model.

'use strict';

const parseProblem = (line, problem) => {
    if (!problem.T || problem.T === 0) {
        problem.T = parseInt(line);
        return problem;
    }

    const cases = problem.cases;

    if (cases.length === 0 || cases[cases.length - 1].arr) {
        cases.push({
            s: line
        });
    } else {
        cases[cases.length - 1].arr = line;
    }

    const isProcessing = cases.length < problem.T || !cases[cases.length - 1].arr;
    problem.isProcessing = isProcessing;

    return problem;
};

const solve = data => {
    const {s, arr} = data;
    const sizes = arr.split(' ').map(i => +i);
    let max = 0;
    const ans = [];

    for(let i = 0; i < s; i++) {
        max = Math.max(f(i, sizes, ans), max);
    }

    return max;
}

const f = (i, sizes, arr) => {
    if(!arr[i]) {
        let max = 0;

        for(let j = 2 * i + 1; j < sizes.length; j += i + 1) {
            if(sizes[j] > sizes[i]) {
                max = Math.max(f(j, sizes, arr), max);
            }
        }

        arr[i] = max + 1;
    }

    return arr[i];
}

const solveCases = cases => {
    for (let index = 0; index < cases.length; index++) {
        const result = solve(cases[index]);
        console.log(result);
    }
};

const main = () => {
    const readline = require('readline');

    let problem = {
        T: 0,
        cases: [],
        isProcessing: true
    };

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

    rl.on('line', line => {
        problem = parseProblem(line, problem);

        if (!problem.isProcessing) {
            rl.close();
        }
    }).on('close', () => {
        solveCases(problem.cases);
        process.exit(0);
    });
};

if (!module.parent) {
    main();
}

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

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

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

    B();
});

function readline() {
    return inputString[currentLine++];
}

function pi(a) {
    return parseInt(a);
}

function ti(a){
    for(let i = 0; i < a.length; i++)
        a[i] = pi(a[i]);

    return a;
}

function B(){
    let t = pi(readline());
    while(t > 0){
        t--;
        let n = pi(readline());
        let s = ti(readline().split(' '));

        let dp = new Array(n);
        dp.fill(1);
        for(let i = 0; i < n; i++){
            let x = 2;
            while((i+1)*x <= n){
                let index = (i+1)*x - 1;
                if(s[index] > s[i]){
                    dp[index] = Math.max(dp[index], dp[i]+1);
                }
                x++;
            }
        }

        let max = 0;
        for(let i = 0; i < n; i++)
            max = Math.max(max, dp[i]);

        //console.log(dp);
        console.log(max);
    }
}

'use strict';

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

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
/**
    4
    4
    5 3 4 6
    7
    1 4 2 3 6 4 9
    5
    5 4 3 2 1
    1
    9

**/

function main() {
    let range = readline();

    for(let r=0;r<range;r++) {
        let n = parseInt(readline());
        let a = readline().split(" ").map((Number));
        a.unshift(0);

        const dp = new Array(n+1).fill(1);

        for(let i=1;i<=n;i++) {
            for(let j=i*2;j<=n;j+=i) {
                    if(a[i] < a[j]) {
                        dp[j] = Math.max(dp[j], dp[i] + 1);
                    }
            }
        }
        console.log(Math.max(...dp));
    }

}

'use strict';

const parseProblem = (line, problem) => {
    if (!problem.T || problem.T === 0) {
        problem.T = parseInt(line);
        return problem;
    }

    const cases = problem.cases;

    if (cases.length === 0 || cases[cases.length - 1].arr) {
        cases.push({
            s: line
        });
    } else {
        cases[cases.length - 1].arr = line;
    }

    const isProcessing = cases.length < problem.T || !cases[cases.length - 1].arr;
    problem.isProcessing = isProcessing;

    return problem;
};

const solve = data => {
    const {s, arr} = data;
    const sizes = arr.split(' ').map(i => +i);
    let res = [];

    for(let i = s - 1; i >= 0; i--) {
        let m = [sizes[i]];

        for(let j = i - 1; j >= 0; j--) {
            if((sizes[j] != m[m.length - 1]) && (m[m.length - 1] % sizes[j] == 0))
                m.push(sizes[j]);
        }

        res.push(m.length);
    }

    res.sort();

    return res[res.length - 1];
}

const solveCases = cases => {
    for (let index = 0; index < cases.length; index++) {
        const result = solve(cases[index]);
        console.log(result);
    }
};

const main = () => {
    const readline = require('readline');

    let problem = {
        T: 0,
        cases: [],
        isProcessing: true
    };

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

    rl.on('line', line => {
        problem = parseProblem(line, problem);

        if (!problem.isProcessing) {
            rl.close();
        }
    }).on('close', () => {
        solveCases(problem.cases);
        process.exit(0);
    });
};

if (!module.parent) {
    main();
}

'use strict';

const parseProblem = (line, problem) => {
    if (!problem.T || problem.T === 0) {
        problem.T = parseInt(line);
        return problem;
    }

    const cases = problem.cases;

    if (cases.length === 0 || cases[cases.length - 1].arr) {
        cases.push({
            s: line
        });
    } else {
        cases[cases.length - 1].arr = line;
    }

    const isProcessing = cases.length < problem.T || !cases[cases.length - 1].arr;
    problem.isProcessing = isProcessing;

    return problem;
};

const solve = data => {
    const {s, arr} = data;
    const sizes = arr.split(' ').map(i => +i);
    let res = [];

    for(let i = 0; i < s; i++) {
        let m = [sizes[i]];

        for(let j = i; j < s; j++) {
            if((sizes[i] != sizes[j - 1]) && (sizes[j] % sizes[j - 1] == 0))
                m.push(sizes[j]);
        }

        res.push(m.length);
    }

    res.sort();

    return res[res.length - 1];
}

const solveCases = cases => {
    for (let index = 0; index < cases.length; index++) {
        const result = solve(cases[index]);
        console.log(result);
    }
};

const main = () => {
    const readline = require('readline');

    let problem = {
        T: 0,
        cases: [],
        isProcessing: true
    };

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

    rl.on('line', line => {
        problem = parseProblem(line, problem);

        if (!problem.isProcessing) {
            rl.close();
        }
    }).on('close', () => {
        solveCases(problem.cases);
        process.exit(0);
    });
};

if (!module.parent) {
    main();
}

'use strict';

const parseProblem = (line, problem) => {
    if (!problem.T || problem.T === 0) {
        problem.T = parseInt(line);
        return problem;
    }

    const cases = problem.cases;

    if (cases.length === 0 || cases[cases.length - 1].arr) {
        cases.push({
            s: line
        });
    } else {
        cases[cases.length - 1].arr = line;
    }

    const isProcessing = cases.length < problem.T || !cases[cases.length - 1].arr;
    problem.isProcessing = isProcessing;

    return problem;
};

const solve = data => {
    const {s, arr} = data;
    const sizes = arr.split(' ').map(i => +i);
    let res = [];

    for(let i = s - 1; i >= 0; i--) {
        let m = [sizes[i]];
        let indexes = [i + 1];

        for(let j = i + 1; j >= 0; j--) {
            if((indexes[indexes.length - 1] % (j + 1) == 0)
                && (m[m.length - 1] > sizes[j])
            ) {
                m.push(sizes[j]);
                indexes.push(j + 1);
            }
        }

        res.push(m.length);
    }

    res.sort();

    return res[res.length - 1];
}

const solveCases = cases => {
    for (let index = 0; index < cases.length; index++) {
        const result = solve(cases[index]);
        console.log(result);
    }
};

const main = () => {
    const readline = require('readline');

    let problem = {
        T: 0,
        cases: [],
        isProcessing: true
    };

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

    rl.on('line', line => {
        problem = parseProblem(line, problem);

        if (!problem.isProcessing) {
            rl.close();
        }
    }).on('close', () => {
        solveCases(problem.cases);
        process.exit(0);
    });
};

if (!module.parent) {
    main();
}

'use strict';

const parseProblem = (line, problem) => {
    if (!problem.T || problem.T === 0) {
        problem.T = parseInt(line);
        return problem;
    }

    const cases = problem.cases;

    if (cases.length === 0 || cases[cases.length - 1].arr) {
        cases.push({
            s: line
        });
    } else {
        cases[cases.length - 1].arr = line;
    }

    const isProcessing = cases.length < problem.T || !cases[cases.length - 1].arr;
    problem.isProcessing = isProcessing;

    return problem;
};

const solve = data => {
    const {s, arr} = data;
    const sizes = arr.split(' ').map(i => +i);
    let res = 1;

    for(let i = s - 1; i >= 0; i--) {
        let indexes = [i + 1];

        for(let j = i + 1; j >= 0; j--) {
            if((indexes[indexes.length - 1] % (j + 1) == 0)
                && (sizes[indexes[indexes.length - 1] - 1] > sizes[j])
            ) {
                indexes.push(j + 1);
            }
        }

        if(indexes.length > res) res = indexes.length;
    }

    return res;
}

const solveCases = cases => {
    for (let index = 0; index < cases.length; index++) {
        const result = solve(cases[index]);
        console.log(result);
    }
};

const main = () => {
    const readline = require('readline');

    let problem = {
        T: 0,
        cases: [],
        isProcessing: true
    };

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

    rl.on('line', line => {
        problem = parseProblem(line, problem);

        if (!problem.isProcessing) {
            rl.close();
        }
    }).on('close', () => {
        solveCases(problem.cases);
        process.exit(0);
    });
};

if (!module.parent) {
    main();
}

'use strict';

const parseProblem = (line, problem) => {
    if (!problem.T || problem.T === 0) {
        problem.T = parseInt(line);
        return problem;
    }

    const cases = problem.cases;

    if (cases.length === 0 || cases[cases.length - 1].arr) {
        cases.push({
            s: line
        });
    } else {
        cases[cases.length - 1].arr = line;
    }

    const isProcessing = cases.length < problem.T || !cases[cases.length - 1].arr;
    problem.isProcessing = isProcessing;

    return problem;
};

const solve = data => {
    const {s, arr} = data;
    const sizes = arr.split(' ').map(i => +i);
    let res = [];

    for(let i = s - 1; i >= 0; i--) {
        let m = [sizes[i]];
        let indexes = [i + 1];

        for(let j = i - 1; j >= 0; j--) {
            if((indexes[indexes.length - 1] % (j + 1) == 0)
                && (m[m.length - 1] > sizes[j])
            ) {
                m.push(sizes[j]);
                indexes.push(j + 1);
            }
        }

        res.push(m.length);
    }

    res.sort();

    return res[res.length - 1];
}

const solveCases = cases => {
    for (let index = 0; index < cases.length; index++) {
        const result = solve(cases[index]);
        console.log(result);
    }
};

const main = () => {
    const readline = require('readline');

    let problem = {
        T: 0,
        cases: [],
        isProcessing: true
    };

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

    rl.on('line', line => {
        problem = parseProblem(line, problem);

        if (!problem.isProcessing) {
            rl.close();
        }
    }).on('close', () => {
        solveCases(problem.cases);
        process.exit(0);
    });
};

if (!module.parent) {
    main();
}

'use strict';

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

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
/**
    4
    4
    5 3 4 6
    7
    1 4 2 3 6 4 9
    5
    5 4 3 2 1
    1
    9

**/

function main() {
    let range = readline();

    for(let r=0;r<range;r++) {
        let n = parseInt(readline());
        let a = readline().split(" ").map((Number));
        a.unshift(0);

        const dp = new Array(n+1).fill(1);

        for(let i=1;i<=n;i++) {
            for(let j=i*2;j<=n;j++) {
                    if(a[i] < a[j]) {
                        dp[j] = Math.max(dp[j], dp[i] + 1);
                    }
            }
        }
        console.log(Math.max(...dp));
    }

}

'use strict';

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

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
/**
    4
    4
    5 3 4 6
    7
    1 4 2 3 6 4 9
    5
    5 4 3 2 1
    1
    9

**/

function main() {
    let range = readline();

    for(let r=0;r<range;r++) {
        let n = parseInt(readline());
        let a = readline().split(" ").map(Number);
        const dp = new Array(n).fill(1);

        for(let i=1;i<n;i++) {
            for(let j=0;j<i;j++) {
                if( (i+1) % (j+1) === 0) {
                    if(a[i] > a[j]) {
                        let index = ((i+1)/(j+1)) - 1;
                        dp[i-1] = Math.max(dp[i-1], dp[index] + 1)
                    }
                }
            }
        }

        console.log(Math.max(...dp));
    }

}

'use strict';

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

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
/**
    4
    4
    5 3 4 6
    7
    1 4 2 3 6 4 9
    5
    5 4 3 2 1
    1
    9

**/

function main() {
    let range = readline();

    for(let r=0;r<range;r++) {
        let n = parseInt(readline());
        let a = readline().split(" ").map(Number);
        a.unshift(1);
        const dp = new Array(n+1).fill(1);

        for(let i=1;i<=n;i++) {
            for(let j=i-1;j>=1;j--) {
                if(i % j=== 0) {
                    let index = i / j;
                    if(a[j] < a[i]) {
                        dp[i] = Math.max(dp[i], dp[index] + 1);
                        break;
                    }
                }
            }
        }
        console.log(Math.max(...dp));
    }

}

'use strict';

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

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
/**
    4
    4
    5 3 4 6
    7
    1 4 2 3 6 4 9
    5
    5 4 3 2 1
    1
    9

**/

function main() {
    let range = readline();

    for(let r=0;r<range;r++) {
        let n = parseInt(readline());
        let a = readline().split(" ").map(Number);
        a.unshift(1);
        const dp = new Array(n+1).fill(1);

        for(let i=1;i<=n;i++) {
            for(let j=i;j<=n;j++) {
                if(j % i=== 0) {
                    if(a[i] < a[j]) {
                        let index = j / i;
                        dp[j] = Math.max(dp[j], dp[index] + 1)
                    }
                }
            }
        }
        console.log(Math.max(...dp));
    }

}

'use strict';

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

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
/**
    4
    4
    5 3 4 6
    7
    1 4 2 3 6 4 9
    5
    5 4 3 2 1
    1
    9

**/

function main() {
    let range = readline();

    for(let r=0;r<range;r++) {
        let n = parseInt(readline());
        let a = readline().split(" ").map(Number);
        a.unshift(1);
        const dp = new Array(n+1).fill(1);

        for(let i=1;i<=n;i++) {
            for(let j=i;j<=n;j++) {
                if(j % i=== 0 && j > i) {
                    if(a[i] < a[j]) {
                        let index = j / i;
                        dp[j] = Math.max(dp[j], dp[index] + 1)
                    }
                }
            }
        }
        console.log(Math.max(...dp));
    }

}

'use strict';

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

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
/**
  3
5 1
8 2
3 4

**/

function main() {
    let range = readline();

    for(let r=0;r<range;r++) {
        let len = parseInt(readline());
        let values = readline().split(" ").map(Number);

        let divisble = [];
        let found = 0;

        for(let i=0;i<len - 1;i++) {
            for(let j=i+1;j<len;j++) {
                if(values[j] > values[i] && (values[j] % values[i] === 0)) {
                    divisble.push(values[i], values[j]);
                    i++;
                    j++;
                }
            }
        }

        if(divisble.length === 0) {
            console.log(1);
            continue;
        }

        let max = Math.max(...divisble);
        let newValue = [];

        for(let i=0;i<max;i++) {
            if(max % divisble[i] === 0) {
                newValue.push(divisble[i]);
            }
        }

        console.log(newValue.length);
    }

}


Gildong is playing a video game called Block Adventure. In Block Adventure, there are $$$n$$$ columns of blocks in a row, and the columns are numbered from $$$1$$$ to $$$n$$$. All blocks have equal heights. The height of the $$$i$$$-th column is represented as $$$h_i$$$, which is the number of blocks stacked in the $$$i$$$-th column.Gildong plays the game as a character that can stand only on the top of the columns. At the beginning, the character is standing on the top of the $$$1$$$-st column. The goal of the game is to move the character to the top of the $$$n$$$-th column.The character also has a bag that can hold infinitely many blocks. When the character is on the top of the $$$i$$$-th column, Gildong can take one of the following three actions as many times as he wants:   if there is at least one block on the column, remove one block from the top of the $$$i$$$-th column and put it in the bag;  if there is at least one block in the bag, take one block out of the bag and place it on the top of the $$$i$$$-th column;  if $$$i < n$$$ and $$$|h_i - h_{i+1}| \le k$$$, move the character to the top of the $$$i+1$$$-st column. $$$k$$$ is a non-negative integer given at the beginning of the game. Note that it is only possible to move to the next column. In actions of the first two types the character remains in the $$$i$$$-th column, and the value $$$h_i$$$ changes.The character initially has $$$m$$$ blocks in the bag. Gildong wants to know if it is possible to win the game. Help Gildong find the answer to his question.

Each test contains one or more test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 1000$$$). Description of the test cases follows. The first line of each test case contains three integers $$$n$$$, $$$m$$$, and $$$k$$$ ($$$1 \le n \le 100$$$, $$$0 \le m \le 10^6$$$, $$$0 \le k \le 10^6$$$) — the number of columns in the game, the number of blocks in the character's bag at the beginning, and the non-negative integer $$$k$$$ described in the statement. The second line of each test case contains $$$n$$$ integers. The $$$i$$$-th integer is $$$h_i$$$ ($$$0 \le h_i \le 10^6$$$), the initial height of the $$$i$$$-th column.

For each test case, print "YES" if it is possible to win the game. Otherwise, print "NO". You can print each letter in any case (upper or lower).

NoteIn the first case, Gildong can take one block from the $$$1$$$-st column, move to the $$$2$$$-nd column, put the block on the $$$2$$$-nd column, then move to the $$$3$$$-rd column.In the second case, Gildong has to put the block in his bag on the $$$1$$$-st column to get to the $$$2$$$-nd column. But it is impossible to get to the $$$3$$$-rd column because $$$|h_2 - h_3| = 3 > k$$$ and there is no way to decrease the gap.In the fifth case, the character is already on the $$$n$$$-th column from the start so the game is won instantly.

const processData = (lines) => {
  const [countTests, ...tests] = lines

  const checkTest = (countRows, cubs, countToNext, rows) => {
    for (let i = 0; i < countRows - 1; i++) {
      cubs += Math.min(rows[i] - rows[i + 1] + countToNext, rows[i])
      if (cubs < 0) return 'NO'
    }
    return 'YES'
  }

  for (let j = 0; j < Number(countTests); j++) {
    const [countRows, cubs, countToNext] = tests[2 * j].split(' ').map(n => Number(n))
    const rows = tests[2 * j + 1].split(' ').map(n => Number(n))
    console.log(checkTest(countRows, cubs, countToNext, rows))
  }
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const { EOL } = require('os')
  const lines = i.split(EOL) /*your input text, split by lines*/
  processData(lines)
})

(function() {
var INPUT = ``;
var OUTPUT = ``;

var main = function() {"use strict";
    // TODO
    var t = rdN();
    loop:while (t --> 0) {
        //pr(t)
        var input = rdArN();
        var n = input[0];
        var m = input[1];
        var k = input[2];
        var H = [null].concat(rdArN());

        for (var i = 1; i < n; ++i) {
            var curH = H[i];
            var nxtH = H[i+1];

            var curH_ = Math.max(nxtH - k, 0);
            if (curH < curH_) {
                m -= curH_ - curH;
                if (m < 0) {
                    pr('NO');
                    continue loop;
                }
            } else {
                m += curH - curH_;
            }
        }

        pr('YES');
    }
};

if(INPUT){INPUT=INPUT.split('\n').reverse();
readline=()=>INPUT.pop();
write=(...s)=>{OUTPUT+=[...s].join(' ')};
print=(...s)=>{write(...s);OUTPUT+='\n'};}
const
rdS=readline,
rdN=()=>+rdS(),
rdArS=()=>rdS().split(' '),
rdArN=()=>rdArS().map(v=>+v),
wr=write,
pr=print,
prAr=(a)=>pr(...a),
prOb=(o)=>pr(JSON.stringify(o,null,4)),
crAr=function(length,...fillArgs){return new Array(length).fill(...fillArgs);},
getPrimes=function(n){var sieve=crAr(n+1,true),primes=[],i,j;for(i=2,j=4;j<sieve.length;j=Math.pow(++i,2)){if(sieve[j]){for(;j<sieve.length;j+=i){sieve[j]=false;}}}for(i=2;i<sieve.length;++i){if(sieve[i]){primes.push(i);}}return primes;},
getPrimeFactors=function(n){var primes=getPrimes(Math.floor(Math.sqrt(n))),last=primes.push(n)-1,factors=[],i,p;for(i=0,p=primes[0];primes[last]>1;){if(primes[last]%p===0){primes[last]/=p;factors.push(p);}else{p=primes[++i];}}return factors;},
defineProperty=(o,pN,v)=>Object.defineProperty(o,pN,{value:v,writable:true,enumerable:false,configurable:true});
defineProperty(Array.prototype,'sortLt',function(){return this.sort((a,b)=>a-b);});
defineProperty(Array.prototype,'sortGt',function(){return this.sort((a,b)=>b-a);});

main();
return OUTPUT;
})();

const processData = (lines) => {
  const [countTests, ...tests] = lines

  const checkTest = (countRows, cubs, countToNext, rows) => {
    for (let i = 0; i < countRows - 1; i++) {
      cubs += rows[i] - rows[i + 1] + countToNext
      if (cubs < 0) return 'NO'
    }
    return 'YES'
  }

  for (let j = 0; j < Number(countTests); j++) {
    const [countRows, cubs, countToNext] = tests[2 * j].split(' ').map(n => Number(n))
    const rows = tests[2 * j + 1].split(' ').map(n => Number(n))
    console.log(checkTest(countRows, cubs, countToNext, rows))
  }
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const { EOL } = require('os')
  const lines = i.split(EOL) /*your input text, split by lines*/
  processData(lines)
})


After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers $$$a_1, a_2, \ldots, a_n$$$, in which every number from $$$1$$$ to $$$n$$$ appears exactly once. The message can be decoded by an arrangement of sequence $$$a$$$ and $$$b$$$, such that the number of matching pairs of elements between them is maximum. A pair of elements $$$a_i$$$ and $$$b_j$$$ is said to match if:   $$$i = j$$$, that is, they are at the same index.  $$$a_i = b_j$$$ His two disciples are allowed to perform the following operation any number of times:   choose a number $$$k$$$ and cyclically shift one of the permutations to the left or right $$$k$$$ times. A single cyclic shift to the left on any permutation $$$c$$$ is an operation that sets $$$c_1:=c_2, c_2:=c_3, \ldots, c_n:=c_1$$$ simultaneously. Likewise, a single cyclic shift to the right on any permutation $$$c$$$ is an operation that sets $$$c_1:=c_n, c_2:=c_1, \ldots, c_n:=c_{n-1}$$$ simultaneously.Help Ishika and Hriday find the maximum number of pairs of elements that match after performing the operation any (possibly zero) number of times.

The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ — the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$b_2$$$, ..., $$$b_n$$$ $$$(1 \le b_i \le n)$$$ — the elements of the second permutation.

Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.

NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For the third case: $$$b$$$ can be shifted to the left by $$$k = 1$$$. The resulting permutations will be $$$\{1, 3, 2, 4\}$$$ and $$$\{2, 3, 1, 4\}$$$. Positions $$$2$$$ and $$$4$$$ have matching pairs of elements. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$2$$$.

// const bg = require('big-integer')
process.stdin.resume()
process.stdin.setEncoding('utf-8')
const MOD1 = 1000000007

function alpha(c = 'A') {
  return [...{
    _b: c === 'A' ? 65 : 97,
    _i: -1,
    [Symbol.iterator]() {
      return this
    },
    next() {
      this._i++
      if (this._i === 26) return {done: true}
      else return {done: false, value: String.fromCharCode(this._i + this._b)}
    }
  }]
}

class rc {
  static construct() {
    this.input = ''
    this.ptr = 0
  }
  static readString() {
    return this.input[this.ptr++]
  }

  static readStrings() {
    return this.input[this.ptr++].split(' ')
  }

  static readInt() {
    return +this.readString()
  }

  static readInts() {
    return this.readStrings().map(a => +a)
  }

  static readBigInteger() {
    return bg(this.readString())
  }

  static readBigIntegers() {
    return this.readStrings().map(a => bg(a))
  }
}

function wr(...x) {
  console.log(...x)
}

function sort(a, inc = true) {
  if (inc) a.sort((a, b) => a - b)
  else a.sort((a, b) => b - a)
}

rc.construct()
// bc.construct()
process.stdin.on('data', (i) => {
  rc.input += i
})

process.stdin.on('end', () => {
  rc.input = rc.input.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))
  main()
})

function main() {
  const n = rc.readInt()
  const a = rc.readInts()
  const b = rc.readInts()

  const x = new Array(n + 1)

  for(let i = 0; i < n; i++) {
    let a1 = a[i]
    let b1 = b[i]
    if(!x[a1]) x[a1] = new Array(4)
    if(!x[b1]) x[b1] = new Array(4)
    x[a1][0] = i
    x[b1][1] = i
  }

  // wr(x)

  for(let i = 0; i < n; i++) {
    let a1 = a[i]
    let diff1 = (x[a1][0] - (x[a1][1] + n)) % n

    x[a1][2] = diff1
  }

  // wr(x)
  let map1 = {}
  for(let i = 1; i <= n; i++) {
    let x1 = x[i][2]
    if(!map1[x1]) map1[x1] = 0
    map1[x1]++
  }
  let m1 = Object.entries(map1).map(a => a[1])
  wr(Math.max(...m1))
}

//↓見なくていいよ！ここから--------------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  myerr("-----start-----");
  var start = new Date();
  Main();
  var end = new Date() - start;
  myerr("----- end -----");
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//↑見なくていいよ！ここまで--------------------------------------------------
function Main(){
	var N = nextInt();
	var alist = nextIntArray();
	var blist = nextIntArray();
	var aIndexes = {};
	for(var i = 0; i < N; i++){
		aIndexes[alist[i]] = i;
	}
	var moveCountRight = {};//右に向かうと一致するのに必要な移動数
	var moveCountLeft = {};//左に向かうと〃
	for(var i = 0; i < N; i++){
		if(aIndexes[blist[i]] > i){
			moveCountRight[blist[i]] = aIndexes[blist[i]] - i;
			moveCountLeft[blist[i]] = i + (N - aIndexes[blist[i]]);
		}else if(aIndexes[blist[i]] < i){
			moveCountRight[blist[i]] = (N - i) + aIndexes[blist[i]];
			moveCountLeft[blist[i]] = i - aIndexes[blist[i]];;
		}else{
			moveCountRight[blist[i]] = 0;
			moveCountLeft[blist[i]] = 0;
		}
	}

	var max = 0;
	var count = {};
	var keys = Object.keys(moveCountRight);
	for(var i = 0; i < keys.length; i++){
		if(count[moveCountRight[keys[i]]] == null){
			count[moveCountRight[keys[i]]] = 1;
		}else{
			count[moveCountRight[keys[i]]]++;
		}
		max = Math.max(max, count[moveCountRight[keys[i]]]);
	}
	myout(max);
}

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

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

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

    C();
});

function readline() {
    return inputString[currentLine++];
}

function pi(a) {
    return parseInt(a);
}

function ti(a){
    for(let i = 0; i < a.length; i++)
        a[i] = pi(a[i]);

    return a;
}

function C(){
    let n = pi(readline());
    let a = ti(readline().split(' '));
    let b = ti(readline().split(' '));

    let map = new Array(300000);
    for(let i = 0; i < a.length; i++){
        map[a[i]] = i;
    }

    let max = 0;
    let countMap = new Array(300000);

    for(let j = 0; j < b.length; j++){
        let i = map[b[j]];
        if(i-j < 0){
            countMap[n-j+i] = countMap[n-j+i] ? countMap[n-j+i]+1 : 1;
            max = Math.max(max, countMap[n-j+i]);
        }else{
            countMap[i-j] = countMap[i-j] ? countMap[i-j]+1 : 1;
            max = Math.max(max, countMap[i-j]);
        }
    }

    console.log(max);
}

'use strict';

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

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
/**
5
4
10 20 20 30
0 1 0 1
3
3 1 2
0 1 1
4
2 2 4 8
1 1 1 1
3
5 15 4
0 0 0
4
20 10 100 50
1 0 0 1

**/

function gcd(a, b) {
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
};

function main() {
    let n = parseInt(readline());
    let a = readline().split(" ").map(Number);
    let b = readline().split(" ").map(Number);

    let offset = [];
    let map = {};

    for(let i=0;i<n;i++) {
        offset[a[i]] = i;
    }

    for(let i=0;i<n;i++) {
        let cur = offset[b[i]] - i;
        if(cur < 0) {
            cur += n;
        }

        if(map[cur]) {
            map[cur]++;
        } else {
            map[cur] = 1;
        }
    }

    let ans = 0;
    Object.keys(map).forEach((x) => {
        ans = Math.max(ans, map[x]);
    });

    console.log(ans);
}

// var lineIdx = 0;
// var readline = () => {
//   var input = ["4", "4 2 3 1", "4 2 3 1"]
//   return input[lineIdx++];
// };
// var print = (str) => {
//   console.log(str);
// };

var n = readline().split(" ").map(function(x) { return parseInt(x); })[0];
var sub = new Array(n);
var res = new Array(n);
for(var i = 0; i < n; i++){
  res[i] = 0;
}

var first = readline().split(" ").map(function(x) { return parseInt(x); }).forEach((x, i) => sub[x - 1] = i);
var second = readline().split(" ").map(function(x) { return parseInt(x); }).forEach((x, i) => {
   sub[x - 1] = sub[x - 1] - i >= 0 ? sub[x - 1] - i : n + sub[x - 1] - i;
   res[sub[x - 1]] = res[sub[x - 1]] + 1;
});

print(res.reduce((p, c) => Math.max(p, c), 0));

// const bg = require('big-integer')
process.stdin.resume()
process.stdin.setEncoding('utf-8')
const MOD1 = 1000000007

function alpha(c = 'A') {
  return [...{
    _b: c === 'A' ? 65 : 97,
    _i: -1,
    [Symbol.iterator]() {
      return this
    },
    next() {
      this._i++
      if (this._i === 26) return {done: true}
      else return {done: false, value: String.fromCharCode(this._i + this._b)}
    }
  }]
}

class rc {
  static construct() {
    this.input = ''
    this.ptr = 0
  }
  static readString() {
    return this.input[this.ptr++]
  }

  static readStrings() {
    return this.input[this.ptr++].split(' ')
  }

  static readInt() {
    return +this.readString()
  }

  static readInts() {
    return this.readStrings().map(a => +a)
  }

  static readBigInteger() {
    return bg(this.readString())
  }

  static readBigIntegers() {
    return this.readStrings().map(a => bg(a))
  }
}

function wr(...x) {
  console.log(...x)
}

function sort(a, inc = true) {
  if (inc) a.sort((a, b) => a - b)
  else a.sort((a, b) => b - a)
}

rc.construct()
// bc.construct()
process.stdin.on('data', (i) => {
  rc.input += i
})

process.stdin.on('end', () => {
  rc.input = rc.input.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))
  main()
})

function main() {
  const n = rc.readInt()
  const a = rc.readInts()
  const b = rc.readInts()

  const x = new Array(n + 1)

  for(let i = 0; i < n; i++) {
    let a1 = a[i]
    let b1 = b[i]
    if(!x[a1]) x[a1] = new Array(4)
    if(!x[b1]) x[b1] = new Array(4)
    x[a1][0] = i
    x[b1][1] = i
  }

  // wr(x)

  for(let i = 0; i < n; i++) {
    let a1 = a[i]
    let diff1 = x[a1][0] - x[a1][1]
    let diff2 = diff1
    if(x[a1][0] === 0 && x[a1][1] !== 0) {
      diff2 = diff1 + n
    }

    x[a1][2] = diff1
    x[a1][3] = diff2
  }

  // wr(x)
  let map1 = {}
  let map2 = {}
  for(let i = 1; i <= n; i++) {
    let x1 = x[i][2]
    let x2 = x[i][3]
    if(!map1[x1]) map1[x1] = 0
    if(!map2[x2]) map2[x2] = 0
    map1[x1]++
    map2[x2]++
  }
  let m1 = Object.entries(map1).map(a => a[1])
  let m2 = Object.entries(map2).map(a => a[1])
  wr(Math.max(...m1, ...m2))
}

// const bg = require('big-integer')
process.stdin.resume()
process.stdin.setEncoding('utf-8')
const MOD1 = 1000000007

function alpha(c = 'A') {
  return [...{
    _b: c === 'A' ? 65 : 97,
    _i: -1,
    [Symbol.iterator]() {
      return this
    },
    next() {
      this._i++
      if (this._i === 26) return {done: true}
      else return {done: false, value: String.fromCharCode(this._i + this._b)}
    }
  }]
}

class rc {
  static construct() {
    this.input = ''
    this.ptr = 0
  }
  static readString() {
    return this.input[this.ptr++]
  }

  static readStrings() {
    return this.input[this.ptr++].split(' ')
  }

  static readInt() {
    return +this.readString()
  }

  static readInts() {
    return this.readStrings().map(a => +a)
  }

  static readBigInteger() {
    return bg(this.readString())
  }

  static readBigIntegers() {
    return this.readStrings().map(a => bg(a))
  }
}

function wr(...x) {
  console.log(...x)
}

function sort(a, inc = true) {
  if (inc) a.sort((a, b) => a - b)
  else a.sort((a, b) => b - a)
}

rc.construct()
// bc.construct()
process.stdin.on('data', (i) => {
  rc.input += i
})

process.stdin.on('end', () => {
  rc.input = rc.input.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))
  main()
})

function main() {
  const n = rc.readInt()
  const a = rc.readInts()
  const b = rc.readInts()

  const x = new Array(n + 1)

  for(let i = 0; i < n; i++) {
    let a1 = a[i]
    let b1 = b[i]
    if(!x[a1]) x[a1] = new Array(4)
    if(!x[b1]) x[b1] = new Array(4)
    x[a1][0] = i
    x[b1][1] = i
  }

  // wr(x)

  for(let i = 0; i < n; i++) {
    let a1 = a[i]
    let diff1 = x[a1][0] - x[a1][1]
    let diff2 = diff1
    if(x[a1][0] === 0 && x[a1][1] !== 0) {
      diff2 = diff1 + n
    }
    if(x[a1][0] === n - 1 && x[a1][1] !== n - 1) {
      diff1 = -1 - x[a1][1]
    }

    x[a1][2] = diff1
    x[a1][3] = diff2
  }

  // wr(x)
  let map1 = {}
  let map2 = {}
  for(let i = 1; i <= n; i++) {
    let x1 = x[i][2]
    let x2 = x[i][3]
    if(!map1[x1]) map1[x1] = 0
    if(!map2[x2]) map2[x2] = 0
    map1[x1]++
    map2[x2]++
  }
  let m1 = Object.entries(map1).map(a => a[1])
  let m2 = Object.entries(map2).map(a => a[1])
  wr(Math.max(...m1, ...m2))
}

// const bg = require('big-integer')
process.stdin.resume()
process.stdin.setEncoding('utf-8')
const MOD1 = 1000000007

function alpha(c = 'A') {
  return [...{
    _b: c === 'A' ? 65 : 97,
    _i: -1,
    [Symbol.iterator]() {
      return this
    },
    next() {
      this._i++
      if (this._i === 26) return {done: true}
      else return {done: false, value: String.fromCharCode(this._i + this._b)}
    }
  }]
}

class rc {
  static construct() {
    this.input = ''
    this.ptr = 0
  }
  static readString() {
    return this.input[this.ptr++]
  }

  static readStrings() {
    return this.input[this.ptr++].split(' ')
  }

  static readInt() {
    return +this.readString()
  }

  static readInts() {
    return this.readStrings().map(a => +a)
  }

  static readBigInteger() {
    return bg(this.readString())
  }

  static readBigIntegers() {
    return this.readStrings().map(a => bg(a))
  }
}

function wr(...x) {
  console.log(...x)
}

function sort(a, inc = true) {
  if (inc) a.sort((a, b) => a - b)
  else a.sort((a, b) => b - a)
}

rc.construct()
// bc.construct()
process.stdin.on('data', (i) => {
  rc.input += i
})

process.stdin.on('end', () => {
  rc.input = rc.input.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))
  main()
})

function main() {
  const n = rc.readInt()
  const a = rc.readInts()
  const b = rc.readInts()

  const x = new Array(n + 1)

  for(let i = 0; i < n; i++) {
    let a1 = a[i]
    let b1 = b[i]
    if(!x[a1]) x[a1] = new Array(4)
    if(!x[b1]) x[b1] = new Array(4)
    x[a1][0] = i
    x[b1][1] = i
  }

  // wr(x)

  for(let i = 0; i < n; i++) {
    let a1 = a[i]
    let diff1 = x[a1][0] - x[a1][1]
    let diff2 = diff1
    if(x[a1][0] === 0 && x[a1][1] !== 0) {
      diff2 = diff1 + n
    }
    if(x[a1][0] === n - 1 && x[a1][1] !== n - 1) {
      diff1 = -1 - x[a1][1]
    }

    x[a1][2] = diff1
    x[a1][3] = diff2
  }

  wr(x)
  let map1 = {}
  let map2 = {}
  for(let i = 1; i <= n; i++) {
    let x1 = x[i][2]
    let x2 = x[i][3]
    if(!map1[x1]) map1[x1] = 0
    if(!map2[x2]) map2[x2] = 0
    map1[x1]++
    map2[x2]++
  }
  let m1 = Object.entries(map1).map(a => a[1])
  let m2 = Object.entries(map2).map(a => a[1])
  wr(Math.max(...m1, ...m2))
}

'use strict';

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

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
/**
5
5 1 2 3 4
1 2 3 4 5

**/

function gcd(a, b) {
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
};

function main() {
    //let range = parseInt(readline());

    //for(let r=0;r<range;r++) {
        let n = parseInt(readline());
        let a = readline().split(" ").map(Number);
        let b = readline().split(" ").map(Number);
        let combination = 0;
        for(let i=0;i<n-1;i++) {
            if(a[i] + 1 === b[i]) {
                combination++;
            }
        }

        if(a[0] === b[n-1]) {
            combination++;
        }

        let combinationX = 0;
        if(a[0] === b[n-1]) {
            combinationX++;
        }

        for(let i=1;i<n;i++) {
            if(a[i] === b[i] - 1) {
                combinationX++;
            }
        }

        console.log(Math.max(combination, combinationX));
    //}
}

'use strict';

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

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
/**
5
5 1 2 3 4
1 2 3 4 5

**/

function gcd(a, b) {
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
};

function main() {
    //let range = parseInt(readline());

    //for(let r=0;r<range;r++) {
        let n = parseInt(readline());
        let a = readline().split(" ").map(Number);
        let b = readline().split(" ").map(Number);

        b.unshift(b[n-1]);
        let combination = 0;
        for(let i=0;i<b.length;i++) {
            if(a[i] === b[i]) {
                combination++;
            }
        }

        b.shift();

        b.push(b[0]);
        let combinationX = 0;

        for(let i=0;i<b.length;i++) {
            if(a[i] === b[i]) {
                combinationX++;
            }
        }

        console.log(Math.max(combination, combinationX));
    //}
}

'use strict';

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

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
/**
5
5 1 2 3 4
1 2 3 4 5

**/

function gcd(a, b) {
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
};

function main() {
    //let range = parseInt(readline());

    //for(let r=0;r<range;r++) {
        let n = parseInt(readline());
        let a = readline().split(" ").map(Number);
        let b = readline().split(" ").map(Number);
        let combination = 0;
        for(let i=0;i<n-1;i++) {
            if(a[i] + 1 === b[i]) {
                combination++;
            }
        }

        if(a[n-1] === n && b[n-1] === 1) {
            combination++;
        }

        let combinationY = 0;
        for(let i=0;i<n-1;i++) {
            if(a[i]  === b[i] + 1) {
                combinationY++;
            }
        }

        if(a[n-1] === 1 && b[n-1] === n) {
            combinationY++;
        }

        combination = Math.max(combination, combinationY);

        let combinationX = 0;
        if(a[0] === n && b[0] === 1) {
            combinationX++;
        }

        for(let i=1;i<n;i++) {
            if(a[i] === b[i] - 1) {
                combinationX++;
            }
        }

        combinationY = 0;
        if(b[0] === n && a[0] === 1) {
            combinationY++;
        }

        for(let i=1;i<n;i++) {
            if(a[i] - 1 === b[i]) {
                combinationY++;
            }
        }

        console.log(Math.max(combination, combinationX, combinationY));
    //}
}

// var lineIdx = 0;
// var readline = () => {
//   var input = ["4", "4 2 3 1", "4 2 3 1"]
//   return input[lineIdx++];
// };
// var print = (str) => {
//   console.log(str);
// };

var n = readline().split(" ").map(function(x) { return parseInt(x); })[0];
var sub = new Array(n);
var res = new Array(n);
for(var i = 0; i < n; i++){
  res[i] = 0;
}

var first = readline().split(" ").map(function(x) { return parseInt(x); }).forEach((x, i) => sub[x - 1] = i);
var second = readline().split(" ").map(function(x) { return parseInt(x); }).forEach((x, i) => {
   sub[x - 1] = sub[x - 1] - i >= 0 ? sub[x - 1] - i : n + sub[x - 1] - i;
   res[sub[x - 1]] = res[sub[x - 1]] + 1;
});

print(res.reduce((p, c) => Math.max(p, c), 0) % n);


Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs.  Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + (i - 1) × B.For a given m, let's define an m-bite operation as decreasing the height of at most m distinct not eaten Karafses by 1. Karafs is considered as eaten when its height becomes zero.Now SaDDas asks you n queries. In each query he gives you numbers l, t and m and you should find the largest number r such that l ≤ r and sequence sl, sl + 1, ..., sr can be eaten by performing m-bite no more than t times or print -1 if there is no such number r.

The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.

For each query, print its answer in a single line.

/* jslint node: true */
function Sum(a1, d, n) {
  return ((a1+a1+(n-1)*d)*n)/2;
}

var input = readline().split(" ").map(Number);
var a1, d, n;
var first = true;
var
  a1 = input[0];
  d = input[1];
  n = input[2];
while( n-- ) {
  input = readline().split(" ").map(Number);
  var
    l = input[0],
    t = input[1],
    m = input[2],
    suml = Sum(a1, d, l-1),
    tm = t*m,
    st = l,
    ed = ( ~~((t-a1)/d) ) + 1,
    md, ans;
  if( st>ed || a1+(l-1)*d>tm ) {
    ans = -1;
  } else {
    while( st<=ed ) {
      md = (st+ed)>>1;
      if( Sum(a1, d, md)-suml<=tm ) {
        ans = md;
        st = md+1;
      } else {
        ed = md-1;
      }
    }
  }
  print(ans);
}

var ABn = readline().split(' ');
var A = Number(ABn[0]),
	B = Number(ABn[1]),
	n = Number(ABn[2]);

for (var i = 0; i < n; i++) {
	var line = readline().split(' ');
	var l = Number(line[0]),
		t = Number(line[1]),
		m = Number(line[2]);
	var heightAtL = A + (l - 1) * B;

	//1
	if (heightAtL > t) {
		print(-1);
		continue;
	}

	//binary search, check heightAtR and
	var MAX = 100000000;
	var low = l, high = MAX, mid, r = -1;

	while (low <= high) {
		mid = (low + high) >> 1;
		var heightAtR = A + (mid - 1) * B;
		if (heightAtR > t) {
			high = mid - 1;
			continue;
		}
		var sum = (mid - l + 1) * heightAtL + (mid - l)* (mid - l + 1) / 2 * B;
		if (sum > t * m) {
			high = mid - 1;
			continue;
		}
		low = mid + 1;
		r = mid;
	}
	print (r);

}

/* jslint node: true */
"use strict";
function Sum(a1, d, n) {
  return ((a1+a1+(n-1)*d)*n) >> 1;
}

var input = readline().split(' ').map(Number);
var a1, d, n;
var first = true;
var
  a1 = input[0];
  d = input[1];
  n = input[2];
while( n-- ) {
  input = readline().split(' ').map(Number);
  var
    l = input[0],
    t = input[1],
    m = input[2],
    suml = Sum(a1, d, l-1),
    tm = t*m,
    st = l,
    ed = ( ((t-a1)/d) | 0 ) + 1,
    md, ans;
  if( st>ed || a1+(l-1)*d>tm ) {
    ans = -1;
  } else {
    while( st<=ed ) {
      md = (st+ed)>>1;
      if( Sum(a1, d, md)-suml<=tm ) {
        ans = md;
        st = md+1;
      } else {
        ed = md-1;
      }
    }
  }
  print(ans);
}

/* jslint node: true */
function Sum(a1, d, n) {
  return ((a1+a1+(n-1)*d)*n)/2;
}

var input = readline().split(" ").map(Number);
var a1, d, n;
var first = true;
var
  a1 = input[0];
  d = input[1];
  n = input[2];
while( n-- ) {
  input = readline().split(" ").map(Number);
  var
    l = input[0],
    t = input[1],
    m = input[2],
    suml = Sum(a1, d, l-1),
    tm = t*m,
    st = l,
    ed = ( ~~((t-a1)/d) ) + 1,
    md, ans;
  print(l, t, m, suml, tm, st, ed);
  if( st>ed || a1+(l-1)*d>tm ) {
    ans = -1;
  } else {
    while( st<=ed ) {
      md = (st+ed)>>1;
      if( Sum(a1, d, md)-suml<=tm ) {
        ans = md;
        st = md+1;
      } else {
        ed = md-1;
      }
    }
  }
  print(ans);
}


Polycarp analyzes the prices of the new berPhone. At his disposal are the prices for $$$n$$$ last days: $$$a_1, a_2, \dots, a_n$$$, where $$$a_i$$$ is the price of berPhone on the day $$$i$$$.Polycarp considers the price on the day $$$i$$$ to be bad if later (that is, a day with a greater number) berPhone was sold at a lower price. For example, if $$$n=6$$$ and $$$a=[3, 9, 4, 6, 7, 5]$$$, then the number of days with a bad price is $$$3$$$ — these are days $$$2$$$ ($$$a_2=9$$$), $$$4$$$ ($$$a_4=6$$$) and $$$5$$$ ($$$a_5=7$$$).Print the number of days with a bad price.You have to answer $$$t$$$ independent data sets.

The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of sets of input data in the test. Input data sets must be processed independently, one after another. Each input data set consists of two lines. The first line contains an integer $$$n$$$ ($$$1 \le n \le 150000$$$) — the number of days. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the price on the $$$i$$$-th day. It is guaranteed that the sum of $$$n$$$ over all data sets in the test does not exceed $$$150000$$$.

Print $$$t$$$ integers, the $$$j$$$-th of which should be equal to the number of days with a bad price in the $$$j$$$-th input data set.

if (process.env.ANT)
{
    global.print = this.print || function(){console.log([...arguments].join(' '))} || require('lol-io').print
    global.write = this.write || require('lol-io').write
    global.readline = this.readline || require('lol-io').readline
    global.debug = function(){console.log('debug:', [...arguments].join(' '))}
    main();
}
else
{
    const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout })
    global.print = console.log
    global.write = (...args) => {
        process.stdout.write(args.join(' '));
    }
    const lines = []
    rl.on('line', line =>{
        lines.push(line);
    });
    rl.on('close', main)
    let rli = 0;
    global.readline = ()=>lines[rli++];
    global.debug = ()=>{};
}

///////////// CODE

function t(n, arr){
    let ans = 0;
    let min = arr[n-1];
    for (let i = n-2; i>=0; i--)
    {
        if (arr[i]>min)
            ans++;
        else
            min = arr[i];
    }
    return ans;
}

function main(){

var q = +readline();
while (q--)
    print(t(+readline(), readline().split(' ').map(n=>+n)));

}

let i = '';
process.stdin.on('data', (c) => {
  i += c;
});
process.stdin.on('end', () => {
  const { EOL } = require('os');
  const lines = i.split(EOL);
  let start = 2;
  while (start < lines.length) {
    let prices = lines[start].split(' ');
    prices = prices.map(price => parseInt(price, 10));
    badPrices(prices);
    start += 2;
  }
});

function badPrices(prices) {
  if (prices.length === 1) {
    console.log('0');
    return;
  }
  let min = prices[prices.length - 1];
  let badDays = 0;
  for (let i = prices.length - 2; i >= 0; i--) {
    if (prices[i] > min) badDays++;
    else min = prices[i];
  }
  console.log(badDays);
}

let lines = ''

process.stdin.resume()
process.stdin.setEncoding('utf-8')
process.stdin.on('data', input => lines += input)
process.stdin.on('end', () => {
  const { EOL } = require('os')
  lines = lines.split(EOL)

  main()
})

function main() {
  const t = Number(lines[0])

  for(let i = 0; i < t; i++) {
    const a = lines[2 * i + 2].split(' ')
    const prev = []
    let r = 0

    a.forEach((b, j) => {
      const c = Number(b)

      if(j === 0) prev.push(c)
      else {
        r = check(prev, c, r)
      }
    })

    console.log(r)
  }
}

function check(arr, v, count) {
  const last = _last(arr)

  if(last <= v || !arr.length) {
    arr.push(v)
    return count
  }
  else {
    arr.pop()
    return check(arr, v, count + 1)
  }
}

function _last(arr) {
  return arr[arr.length - 1]
}

'use strict'

const fn = (n, a) => {
    let m = a[n-1];
    let r = 0;
    for(let i = n-2; i > -1; i--) {
        if (a[i] > m) r++;
        else m = a[i];
    }
    return r;
}

let t = parseInt(readline());
while(t--) write(fn(parseInt(readline()), readline().split(' ').map(Number)) + '\n');

var t = parseInt(readline(), 10);

while(t--) {
    var n = parseInt(readline(), 10);
    var a = readline().split(' ');
    var min = parseInt(a[n-1], 10), count = 0;

    for(var i=n-1; i>=0; i--) {
        a[i] = parseInt(a[i], 10);

        if(a[i] > min) count++;
        else if(a[i] < min) min = a[i];
    }

    print(count);
}

(function() {
var INPUT = ``;
var OUTPUT = ``;

var main = function() {"use strict";
    // TODO
    var t = rdN();
    while (t --> 0) {
        var res = 0;

        var n = rdN();
        var A = rdArN();
        var min = A[n-1];
        for (var i = n-2; i >= 0; --i) {
            if (A[i] > min) {
                ++res;
            }
            min = Math.min(min, A[i]);
        }

        pr(res);
    }
};

if(INPUT){INPUT=INPUT.split('\n').reverse();
readline=()=>INPUT.pop();
write=(...s)=>{OUTPUT+=[...s].join(' ')};
print=(...s)=>{write(...s);OUTPUT+='\n'};}
const
rdS=readline,
rdN=()=>+rdS(),
rdArS=()=>rdS().split(' '),
rdArN=()=>rdArS().map(v=>+v),
wr=write,
pr=print,
prAr=(a)=>pr(...a),
prOb=(o)=>pr(JSON.stringify(o,null,4)),
crAr=function(length,...fillArgs){return new Array(length).fill(...fillArgs);},
getPrimes=function(n){var sieve=crAr(n+1,true),primes=[],i,j;for(i=2,j=4;j<sieve.length;j=Math.pow(++i,2)){if(sieve[j]){for(;j<sieve.length;j+=i){sieve[j]=false;}}}for(i=2;i<sieve.length;++i){if(sieve[i]){primes.push(i);}}return primes;},
getPrimeFactors=function(n){var primes=getPrimes(Math.floor(Math.sqrt(n))),last=primes.push(n)-1,factors=[],i,p;for(i=0,p=primes[0];primes[last]>1;){if(primes[last]%p===0){primes[last]/=p;factors.push(p);}else{p=primes[++i];}}return factors;},
defineProperty=(o,pN,v)=>Object.defineProperty(o,pN,{value:v,writable:true,enumerable:false,configurable:true});
defineProperty(Array.prototype,'sortLt',function(){return this.sort((a,b)=>a-b);});
defineProperty(Array.prototype,'sortGt',function(){return this.sort((a,b)=>b-a);});

main();
return OUTPUT;
})();


The map of Berland is a rectangle of the size n × m, which consists of cells of size 1 × 1. Each cell is either land or water. The map is surrounded by the ocean. Lakes are the maximal regions of water cells, connected by sides, which are not connected with the ocean. Formally, lake is a set of water cells, such that it's possible to get from any cell of the set to any other without leaving the set and moving only to cells adjacent by the side, none of them is located on the border of the rectangle, and it's impossible to add one more water cell to the set such that it will be connected with any other cell.You task is to fill up with the earth the minimum number of water cells so that there will be exactly k lakes in Berland. Note that the initial number of lakes on the map is not less than k.

The first line of the input contains three integers n, m and k (1 ≤ n, m ≤ 50, 0 ≤ k ≤ 50) — the sizes of the map and the number of lakes which should be left on the map. The next n lines contain m characters each — the description of the map. Each of the characters is either '.' (it means that the corresponding cell is water) or '*' (it means that the corresponding cell is land). It is guaranteed that the map contain at least k lakes.

In the first line print the minimum number of cells which should be transformed from water to land.  In the next n lines print m symbols — the map after the changes. The format must strictly follow the format of the map in the input data (there is no need to print the size of the map). If there are several answers, print any of them.  It is guaranteed that the answer exists on the given data.

NoteIn the first example there are only two lakes — the first consists of the cells (2, 2) and (2, 3), the second consists of the cell (4, 3). It is profitable to cover the second lake because it is smaller. Pay attention that the area of water in the lower left corner is not a lake because this area share a border with the ocean.

var arr = readline().split(' ');
var M = Number(arr[0]);
var N = Number(arr[1]);
var K = Number(arr[2]);
var rs = 0;

var rect = [];
for (var i = 0;i < M;i ++) {
	var _str = readline().split(' ')[0];
	rect[i] = _str.split('');
}

var obj_arr = [];

for (var i = 0;i < M;i ++) {
	var _str = rect[i];
	for (var j = 0;j < N;j ++) {
		if (_str[j] == '.') {
			var area = helper(i, j);
			if (area > 0) {
				obj_arr.push({
					start_x: i,
					start_y: j,
					area: area
				});
			}
		}
	}
}

if (obj_arr.length > K) {
	for (var i = 0;i < obj_arr.length;i ++) {
		for (var j = i + 1;j < obj_arr.length;j ++) {
			if (obj_arr[i].area > obj_arr[j].area) {
				var tmp = obj_arr[i];
				obj_arr[i] = obj_arr[j];
				obj_arr[j] = tmp;
			}
		}
	}
	var index = 0;
	var tmp = obj_arr.length - K;
	while (tmp) {
		var obj = obj_arr[index];
		fill(obj.start_x, obj.start_y);
		index ++;
		tmp--;
	}
}

for (var i = 0;i < M;i ++) {
	for (var j = 0;j < N;j ++) {
		if (rect[i][j] == '&') {
			rect[i][j] = '.';
		}
	}
}

print(rs);

for (var i = 0;i < M;i ++) {
	var _str = "";
	for (var j = 0;j < N;j++) {
		_str += rect[i][j];
	}
	print(_str);
}

function helper(_x, _y) {
	if (_x < 0 || _y < 0 || _x >= M  || _y >= N) {
		return -1;
	}
	if (rect[_x][_y] != '.') {
		return 0;
	}
	rect[_x][_y] = '&';
	var area1 = helper(_x - 1, _y);
	var area2 = helper(_x + 1, _y);
	var area3 = helper(_x, _y - 1);
	var area4 = helper(_x, _y + 1);
	if (area1 < 0 || area2 < 0 || area3 < 0 || area4 < 0) {
		return -1;
	}
	return  area1 + area2 + area3 + area4 + 1;
}

function fill (_x, _y) {
	if (_x < 0 || _y < 0 || _x >= M  || _y >= N) {
		return;
	}
	if (rect[_x][_y] == '&') {
		rs ++;
		rect[_x][_y] = '*';
		fill(_x - 1, _y);
		fill(_x + 1, _y);
		fill(_x, _y - 1);
		fill(_x, _y + 1);
	}
}

/**
 * https://codeforces.com/problemset/problem/723/D
 */

'use strict';
const readline = require('readline');
const fs = require('fs');

const rl = readline.createInterface({
    input: process.stdin,
    // input: fs.createReadStream('src/LECTURE 06: DFS/0.input1.json'),
    output: process.stdout,
    terminal: false,
});

const lines = [];
let currentLine = 0;

const direction = [
    { x: 1, y: 0 },
    { x: -1, y: 0 },
    { x: 0, y: 1 },
    { x: 0, y: -1 },
];
/**
 * Time complexity:
 * Space complexity:
 */
rl.on('line', function (line) {
    lines.push(line.trim());
}).on('close', () => {
    const read = () => lines[currentLine++];
    let [rows, columns, k] = read().split(' ').map(Number);

    const isInRange = ({ x, y }) => x >= 0 && y >= 0 && x <= rows - 1 && y <= columns - 1;
    const isOnBorder = ({ x, y }) => [0, rows - 1].indexOf(x) > -1 || [0, columns - 1].indexOf(y) > -1;

    let visited = {};
    let matrix = [];
    let lakes = [];
    for (let row = 0; row < rows; row++) {
        matrix.push(read().split(''));
    }
    for (let row = 1; row < rows - 1; row++) {
        for (let col = 1; col < columns - 1; col++) {
            let key = `${row}-${col}`;
            if (matrix[row][col] !== '.' || visited[key]) {
                continue;
            }

            let stack = [{ x: row, y: col }],
                isLake = true,
                lake = [{ x: row, y: col }];

            visited[key] = true;

            while (stack.length > 0) {
                let node = stack.pop();

                for (let d of direction) {
                    let [x, y] = [node.x + d.x, node.y + d.y];
                    let dKey = `${x}-${y}`;
                    if (!visited[dKey] && isInRange({ x, y }) && matrix[x][y] === '.') {
                        visited[dKey] = true;
                        stack.push({ x, y });
                        lake.push({ x, y });

                        if (isOnBorder({ x, y })) {
                            isLake = false;
                        }
                    }
                }
            }
            if (isLake) {
                lakes.push(lake);
            }
        }
    }

    lakes.sort((a, b) => a.length - b.length);
    let count = 0;
    for (let i = lakes.length; i > k; i--) {
        let lake = lakes.shift();
        count += lake.length;
        lake.forEach(({ x, y }) => (matrix[x][y] = '*'));
    }
    console.log(count);
    console.log(matrix.map((row) => row.join('')).join('\n'));
});

'use strict';

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

let inputString = '';
let currentLine = 0;

process.stdin.on('data', (inputStdin) => {
  inputString += inputStdin;
});

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

  main();
});

function readline() {
  return inputString[currentLine++];
}

const direction = [
  [0, 1],
  [0, -1],
  [1, 0],
  [-1, 0],
];

// Make a Snippet for the code above this and then write your logic in main()
function main() {
  const [n, m, k] = readline().split(' ').map(Number);
  const isOcean = (row, col) =>
    row === 0 || row === n - 1 || col === 0 || col === m - 1;
  const isInRange = (row, col) =>
    row >= 0 && row <= n - 1 && col >= 0 && col <= m - 1;
  let matrix = new Array(n);
  for (let i = 0; i < n; i++) {
    matrix[i] = readline().split('');
  }

  let visited = {};
  let lakes = [];

  for (let i = 0; i < n; i++) {
    for (let j = 0; j < m; j++) {
      if (matrix[i][j] === '.' && !visited[`${i}-${j}`]) {
        let stack = [[i, j]];
        visited[`${i}-${j}`] = true;
        let lake = [];
        let isLake = true;
        while (stack.length) {
          const [row, col] = stack.pop();

          lake.push([row, col]);
          if (isOcean(row, col)) isLake = false;
          for (let k = 0; k < direction.length; k++) {
            const x = row + direction[k][0];
            const y = col + direction[k][1];
            if (
              isInRange(x, y) &&
              matrix[x][y] === '.' &&
              !visited[`${x}-${y}`]
            ) {
              stack.push([x, y]);
              visited[`${x}-${y}`] = true;
            }
          }
        }

        if (isLake) {
          lakes.push(lake);
        }
      }
    }
  }
  lakes.sort((l1, l2) => l2.length - l1.length);
  let cnt = 0;

  lakes.forEach((lake, i) => {
    if (i >= k) {
      // transform
      lake.forEach(([i, j]) => {
        matrix[i][j] = '*';
        cnt++;
      });
    }
  });
  console.log(cnt);
  for (let i = 0; i < n; i++) {
    console.log(matrix[i].join(''));
  }
}

'use strict';

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

let inputString = '';
let currentLine = 0;

process.stdin.on('data', (inputStdin) => {
  inputString += inputStdin;
});

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

  main();
});

function readline() {
  return inputString[currentLine++];
}

// Make a Snippet for the code above this and then write your logic in main()
function main() {
  const [n, m, k] = readline().split(' ').map(Number);
  const isOcean = (row, col) =>
    row === 0 || row === n - 1 || col === 0 || col === m - 1;
  let matrix = new Array(n);
  for (let i = 0; i < n; i++) {
    matrix[i] = readline().split('');
  }

  let visited = {};
  let lakes = [];

  for (let i = 0; i < n; i++) {
    for (let j = 0; j < m; j++) {
      if (matrix[i][j] === '.' && !visited[`${i}-${j}`]) {
        let stack = [[i, j]];
        visited[`${i}-${j}`] = true;
        let lake = [];
        let isLake = true;
        while (stack.length) {
          const [row, col] = stack.pop();

          lake.push([row, col]);
          if (isOcean(row, col)) isLake = false;
          if (
            row > 0 &&
            matrix[row - 1][col] === '.' &&
            !visited[`${row - 1}-${col}`]
          ) {
            stack.push([row - 1, col]);
            visited[`${row - 1}-${col}`] = true;
          }
          if (
            row < n - 1 &&
            matrix[row + 1][col] === '.' &&
            !visited[`${row + 1}-${col}`]
          ) {
            stack.push([row + 1, col]);
            visited[`${row + 1}-${col}`] = true;
          }
          if (
            col > 0 &&
            matrix[row][col - 1] === '.' &&
            !visited[`${row}-${col - 1}`]
          ) {
            stack.push([row, col - 1]);
            visited[`${row}-${col - 1}`] = true;
          }
          if (
            col < m - 1 &&
            matrix[row][col + 1] === '.' &&
            !visited[`${row}-${col + 1}`]
          ) {
            stack.push([row, col + 1]);
            visited[`${row}-${col + 1}`] = true;
          }
        }

        if (isLake) {
          lakes.push(lake);
        }
      }
    }
  }
  lakes.sort((l1, l2) => l2.length - l1.length);
  let cnt = 0;

  lakes.forEach((lake, i) => {
    if (i >= k) {
      // transform
      lake.forEach(([i, j]) => {
        matrix[i][j] = '*';
        cnt++;
      });
    }
  });
  console.log(cnt);
  for (let i = 0; i < n; i++) {
    console.log(matrix[i].join(''));
  }
}

var arr = readline().split(' ');
var M = Number(arr[0]);
var N = Number(arr[1]);
var K = Number(arr[2]);
var rs = 0;

var rect = [];
for (var i = 0;i < M;i ++) {
	var _str = readline().split(' ')[0];
	rect[i] = _str.split('');
}

var obj_arr = [];

for (var i = 0;i < M;i ++) {
	var _str = rect[i];
	for (var j = 0;j < N;j ++) {
		if (_str[j] == '.') {
			var area = helper(i, j);
			if (area > 0) {
				obj_arr.push({
					start_x: i,
					start_y: j,
					area: area
				});
			}
		}
	}
}

if (obj_arr.length > K) {
	for (var i = 0;i < obj_arr.length;i ++) {
		for (var j = i + 1;j < obj_arr.length;j ++) {
			if (obj_arr[i].area > obj_arr[j].area) {
				var tmp = obj_arr[i];
				obj_arr[i] = obj_arr[j];
				obj_arr[j] = tmp;
			}
		}
	}
	var index = 0;
	var tmp = obj_arr.length - K;
	while (tmp) {
		var obj = obj_arr[index];
		fill(obj.start_x, obj.start_y);
		index ++;
		tmp--;
	}
}

for (var i = 0;i < M;i ++) {
	for (var j = 0;j < N;j ++) {
		if (rect[i][j] == '&') {
			rect[i][j] = '.';
		}
	}
}

print(rs);

for (var i = 0;i < M;i ++) {
	var _str = "";
	for (var j = 0;j < N;j++) {
		_str += rect[i][j];
	}
	print(_str);
}

function helper(_x, _y) {
	if (_x < 0 || _y < 0 || _x >= M  || _y >= N) {
		return -1;
	}
	if (rect[_x][_y] != '.') {
		return 0;
	}
	rect[_x][_y] = '&';
	var area1 = helper(_x - 1, _y);
	var area2 = helper(_x + 1, _y);
	var area3 = helper(_x, _y - 1);
	var area4 = helper(_x, _y + 1);
	if (area1 < 0 || area2 < 0 || area3 < 0 || area4 < 0) {
		return -1;
	}
	return  area1 + area2 + area3 + area4 + 1;
}

function fill (_x, _y) {
	if (_x < 0 || _y < 0 || _x >= M  || _y >= N) {
		return;
	}
	if (rect[_x][_y] == '&') {
		rect[_x][_y] = '*';
		fill(_x - 1, _y);
		fill(_x + 1, _y);
		fill(_x, _y - 1);
		fill(_x, _y + 1);
	}
}

/**
 * https://codeforces.com/problemset/problem/723/D
 */

'use strict';
const readline = require('readline');
const fs = require('fs');

const rl = readline.createInterface({
    input: process.stdin,
    // input: fs.createReadStream('src/LECTURE 06: DFS/0.input1.json'),
    output: process.stdout,
    terminal: false,
});

const lines = [];
let currentLine = 0;

const direction = [
    { x: 1, y: 0 },
    { x: -1, y: 0 },
    { x: 0, y: 1 },
    { x: 0, y: -1 },
];
/**
 * Time complexity:
 * Space complexity:
 */
rl.on('line', function (line) {
    lines.push(line.trim());
}).on('close', () => {
    const read = () => lines[currentLine++];
    let [m, n, k] = read().split(' ').map(Number);

    const isInRange = ({ x, y }) => x >= 0 && y >= 0 && x <= m - 1 && y <= n - 1;

    let parentVisited = {};
    let matrix = [];
    let lakes = [];
    for (let row = 0; row < m; row++) {
        matrix.push(read().split(''));
    }
    for (let row = 1; row < m - 1; row++) {
        for (let col = 1; col < n - 1; col++) {
            let rect = matrix[row][col];
            let key = `${row}-${col}`;
            if (rect !== '.' || parentVisited[key]) {
                continue;
            }
            let visited = { [key]: true },
                stack = [{ x: row, y: col }];

            let isLake = true;
            let lake = [{ x: row, y: col }];
            while (stack.length > 0) {
                let node = stack.pop();

                for (let d of direction) {
                    let x = node.x + d.x,
                        y = node.y + d.y;
                    let dKey = `${x}-${y}`;
                    if (!visited[dKey] && isInRange({ x, y }) && matrix[x][y] === '.') {
                        visited[dKey] = true;
                        parentVisited[dKey] = true;
                        stack.push({ x, y });
                        lake.push({ x, y });

                        if ([0, m - 1].indexOf(x) > -1 || [0, n - 1].indexOf(y) > -1) {
                            isLake = false;
                        }
                    }
                }
            }
            if (isLake) {
                lakes.push(lake);
            }
        }
    }

    lakes.sort((a, b) => a.length - b.length);
    let count = 0;
    for (let i = lakes.length; i > k; i--) {
        let lake = lakes.shift();
        count++;
        lake.forEach(({ x, y }) => (matrix[x][y] = '*'));
    }
    console.log(count);
    console.log(matrix.map((row) => row.join('')).join('\n'));
});

/**
 * https://codeforces.com/problemset/problem/723/D
 */

'use strict';
const readline = require('readline');
const fs = require('fs');

const rl = readline.createInterface({
    input: process.stdin,
    // input: fs.createReadStream('src/LECTURE 06: DFS/0.input1.json'),
    output: process.stdout,
    terminal: false,
});

const lines = [];
let currentLine = 0;

const direction = [
    { x: 1, y: 0 },
    { x: -1, y: 0 },
    { x: 0, y: 1 },
    { x: 0, y: -1 },
];
/**
 * Time complexity:
 * Space complexity:
 */
rl.on('line', function (line) {
    lines.push(line.trim());
}).on('close', () => {
    const read = () => lines[currentLine++];
    let [rows, columns, k] = read().split(' ').map(Number);

    const isInRange = ({ x, y }) => x >= 0 && y >= 0 && x <= rows - 1 && y <= columns - 1;
    const isOnBorder = ({ x, y }) =>
        [0, rows - 1].indexOf(x) > -1 || [0, columns - 1].indexOf(y) > -1;

    let visited = {};
    let matrix = [];
    let lakes = [];
    for (let row = 0; row < rows; row++) {
        matrix.push(read().split(''));
    }
    for (let row = 1; row < rows - 1; row++) {
        for (let col = 1; col < columns - 1; col++) {
            let key = `${row}-${col}`;
            if (matrix[row][col] !== '.' || visited[key]) {
                continue;
            }

            let stack = [{ x: row, y: col }],
                isLake = true,
                lake = [];

            visited = { [key]: true };

            while (stack.length > 0) {
                let node = stack.pop();
                lake.push(node);

                if (isOnBorder(node)) {
                    isLake = false;
                }

                for (let d of direction) {
                    let [x, y] = [node.x + d.x, node.y + d.y];
                    let dKey = `${x}-${y}`;
                    if (!visited[dKey] && isInRange({ x, y }) && matrix[x][y] === '.') {
                        visited[dKey] = true;
                        stack.push({ x, y });
                    }
                }
            }
            if (isLake) {
                lakes.push(lake);
            }
        }
    }

    lakes.sort((a, b) => a.length - b.length);
    let count = 0;
    for (let i = 0; i < lakes.length - k; i++) {
        let lake = lakes[i];
        count += lake.length;
        lake.forEach(({ x, y }) => (matrix[x][y] = '*'));
    }
    console.log(count);
    console.log(matrix.map((row) => row.join('')).join('\n'));
});

/**
 * https://codeforces.com/problemset/problem/723/D
 */

'use strict';
const readline = require('readline');
const fs = require('fs');

const rl = readline.createInterface({
    input: process.stdin,
    // input: fs.createReadStream('src/LECTURE 06: DFS/0.input1.json'),
    output: process.stdout,
    terminal: false,
});

const lines = [];
let currentLine = 0;

const direction = [
    { x: 1, y: 0 },
    { x: -1, y: 0 },
    { x: 0, y: 1 },
    { x: 0, y: -1 },
];
/**
 * Time complexity:
 * Space complexity:
 */
rl.on('line', function (line) {
    lines.push(line.trim());
}).on('close', () => {
    const read = () => lines[currentLine++];
    let [rows, columns, k] = read().split(' ').map(Number);

    const isInRange = ({ x, y }) => x >= 0 && y >= 0 && x <= rows - 1 && y <= columns - 1;
    const isOnBorder = ({ x, y }) =>
        [0, rows - 1].indexOf(x) > -1 || [0, columns - 1].indexOf(y) > -1;

    let visited = {};
    let matrix = [];
    let lakes = [];
    for (let row = 0; row < rows; row++) {
        matrix.push(read().split(''));
    }
    for (let row = 1; row < rows - 1; row++) {
        for (let col = 1; col < columns - 1; col++) {
            let key = `${row}-${col}`;
            if (matrix[row][col] !== '.' || visited[key]) {
                continue;
            }

            let stack = [{ x: row, y: col }],
                isLake = true,
                lake = [{ x: row, y: col }];

            visited = { [key]: true };

            while (stack.length > 0) {
                let node = stack.pop();

                for (let d of direction) {
                    let [x, y] = [node.x + d.x, node.y + d.y];
                    let dKey = `${x}-${y}`;
                    if (!visited[dKey] && isInRange({ x, y }) && matrix[x][y] === '.') {
                        visited[dKey] = true;
                        stack.push({ x, y });
                        lake.push({ x, y });

                        if (isOnBorder({ x, y })) {
                            isLake = false;
                        }
                    }
                }
            }
            if (isLake) {
                lakes.push(lake);
            }
        }
    }

    lakes.sort((a, b) => a.length - b.length);
    let count = 0;
    for (let i = lakes.length; i > k; i--) {
        let lake = lakes.shift();
        count += lake.length;
        lake.forEach(({ x, y }) => (matrix[x][y] = '*'));
    }
    console.log(count);
    console.log(matrix.map((row) => row.join('')).join('\n'));
});

/**
 * https://codeforces.com/problemset/problem/723/D
 */

'use strict';
const readline = require('readline');
const fs = require('fs');

const rl = readline.createInterface({
    input: process.stdin,
    // input: fs.createReadStream('src/LECTURE 06: DFS/0.input1.json'),
    output: process.stdout,
    terminal: false,
});

const lines = [];
let currentLine = 0;

const direction = [
    { x: 1, y: 0 },
    { x: -1, y: 0 },
    { x: 0, y: 1 },
    { x: 0, y: -1 },
];
/**
 * Time complexity:
 * Space complexity:
 */
rl.on('line', function (line) {
    lines.push(line.trim());
}).on('close', () => {
    const read = () => lines[currentLine++];
    let [m, n, k] = read().split(' ').map(Number);

    const isInRange = ({ x, y }) => x >= 0 && y >= 0 && x <= m - 1 && y <= n - 1;
    const isOnBorder = ({ x, y }) => [0, m - 1].indexOf(x) > -1 || [0, n - 1].indexOf(y) > -1;

    let visited = {};
    let matrix = [];
    let lakes = [];
    for (let row = 0; row < m; row++) {
        matrix.push(read().split(''));
    }
    for (let row = 1; row < m - 1; row++) {
        for (let col = 1; col < n - 1; col++) {
            let rect = matrix[row][col],
                key = `${row}-${col}`;
            if (rect !== '.' || visited[key]) {
                continue;
            }

            let stack = [{ x: row, y: col }],
                isLake = true,
                lake = [{ x: row, y: col }];

            visited = { [key]: true };

            while (stack.length > 0) {
                let node = stack.pop();

                for (let d of direction) {
                    let [x, y] = [node.x + d.x, node.y + d.y];
                    let dKey = `${x}-${y}`;
                    if (!visited[dKey] && isInRange({ x, y }) && matrix[x][y] === '.') {
                        visited[dKey] = true;
                        stack.push({ x, y });
                        lake.push({ x, y });

                        if (isOnBorder({ x, y })) {
                            isLake = false;
                        }
                    }
                }
            }
            if (isLake) {
                lakes.push(lake);
            }
        }
    }

    lakes.sort((a, b) => a.length - b.length);
    let count = 0;
    for (let i = lakes.length; i > k; i--) {
        let lake = lakes.shift();
        count += lake.length;
        lake.forEach(({ x, y }) => (matrix[x][y] = '*'));
    }
    console.log(count);
    console.log(matrix.map((row) => row.join('')).join('\n'));
});

/**
 * https://codeforces.com/problemset/problem/723/D
 */

'use strict';
const readline = require('readline');
const fs = require('fs');

const rl = readline.createInterface({
    input: process.stdin,
    // input: fs.createReadStream('src/LECTURE 06: DFS/0.input1.json'),
    output: process.stdout,
    terminal: false,
});

const lines = [];
let currentLine = 0;

const direction = [
    { x: 1, y: 0 },
    { x: -1, y: 0 },
    { x: 0, y: 1 },
    { x: 0, y: -1 },
];
/**
 * Time complexity:
 * Space complexity:
 */
rl.on('line', function (line) {
    lines.push(line.trim());
}).on('close', () => {
    const read = () => lines[currentLine++];
    let [m, n, k] = read().split(' ').map(Number);

    const isInRange = ({ x, y }) => x >= 0 && y >= 0 && x <= m - 1 && y <= n - 1;
    const isOnBorder = ({ x, y }) => [0, m - 1].indexOf(x) > -1 || [0, n - 1].indexOf(y) > -1;

    let visited = {};
    let matrix = [];
    let lakes = [];
    for (let row = 0; row < m; row++) {
        matrix.push(read().split(''));
    }
    for (let row = 1; row < m - 1; row++) {
        for (let col = 1; col < n - 1; col++) {
            let rect = matrix[row][col],
                key = `${row}-${col}`;
            if (rect !== '.' || visited[key]) {
                continue;
            }

            let stack = [{ x: row, y: col }],
                isLake = true,
                lake = [{ x: row, y: col }];

            visited = { [key]: true };

            while (stack.length > 0) {
                let node = stack.pop();

                for (let d of direction) {
                    let [x, y] = [node.x + d.x, node.y + d.y];
                    let dKey = `${x}-${y}`;
                    if (!visited[dKey] && isInRange({ x, y }) && matrix[x][y] === '.') {
                        visited[dKey] = true;
                        stack.push({ x, y });
                        lake.push({ x, y });

                        if (isOnBorder({ x, y })) {
                            isLake = false;
                        }
                    }
                }
            }
            if (isLake) {
                lakes.push(lake);
            }
        }
    }

    lakes.sort((a, b) => a.length - b.length);
    console.log(lakes.length);
    let count = 0;
    for (let i = lakes.length; i > k; i--) {
        let lake = lakes.shift();
        count += lake.length;
        lake.forEach(({ x, y }) => (matrix[x][y] = '*'));
    }
    console.log(count);
    console.log(matrix.map((row) => row.join('')).join('\n'));
});

'use strict';

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

let inputString = '';
let currentLine = 0;

process.stdin.on('data', (inputStdin) => {
  inputString += inputStdin;
});

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

  main();
});

function readline() {
  return inputString[currentLine++];
}

const direction = [
  [0, 1],
  [0, -1],
  [1, 0],
  [-1, 0],
];

// Make a Snippet for the code above this and then write your logic in main()
function main() {
  const [n, m, k] = readline().split(' ').map(Number);
  const isOcean = (row, col) =>
    row === 0 || row === n - 1 || col === 0 || col === m - 1;
  const isInRange = (row, col) =>
    row >= 0 && row <= n - 1 && col >= 0 && col <= m - 1;
  let matrix = new Array(n);
  for (let i = 0; i < n; i++) {
    matrix[i] = readline().split('');
  }

  let visited = {};
  let lakes = [];

  for (let i = 0; i < n; i++) {
    for (let j = 0; j < m; j++) {
      if (matrix[i][j] === '.' && !visited[`${i}-${j}`]) {
        let stack = [[i, j]];
        visited[`${i}-${j}`] = true;
        let lake = [];
        let isLake = true;
        while (stack.length) {
          const [row, col] = stack.pop();

          lake.push([row, col]);
          if (isOcean(row, col)) isLake = false;
          for (let k = 0; k < direction.length; k++) {
            const x = row + direction[k][0];
            const y = col + direction[k][1];
            if (
              isInRange(x, y) &&
              matrix[x][y] === '.' &&
              !visited[`${x}-${y}`]
            ) {
              stack.push([x, y]);
              visited[`${x}-${y}`] = true;
            }
          }
        }

        if (isLake) {
          lakes.push(lake);
        }
      }
    }
  }
  console.log(lakes);
  lakes.sort((l1, l2) => l2.length - l1.length);
  let cnt = 0;

  lakes.forEach((lake, i) => {
    if (i >= k) {
      // transform
      lake.forEach(([i, j]) => {
        matrix[i][j] = '*';
        cnt++;
      });
    }
  });
  console.log(cnt);
  for (let i = 0; i < n; i++) {
    console.log(matrix[i].join(''));
  }
}

'use strict';

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

let inputString = '';
let currentLine = 0;

process.stdin.on('data', (inputStdin) => {
  inputString += inputStdin;
});

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

  main();
});

function readline() {
  return inputString[currentLine++];
}

// Make a Snippet for the code above this and then write your logic in main()
function main() {
  const [n, m, k] = readline().split(' ').map(Number);
  const isOcean = (x, y) => x === 0 || x === n - 1 || y === 0 || y === m - 1;
  let matrix = new Array(n);
  for (let i = 0; i < n; i++) {
    matrix[i] = readline().split('');
  }

  let visited = {};
  let lakes = [];

  for (let i = 0; i < n; i++) {
    for (let j = 0; j < m; j++) {
      if (matrix[i][j] === '.' && !visited[`${i}-${j}`]) {
        let stack = [[i, j]];
        let lake = [];
        let isLake = true;
        while (stack.length) {
          const [row, col] = stack.pop();
          visited[`${row}-${col}`] = true;
          lake.push([row, col]);
          if (isOcean(row, col)) isLake = false;
          if (
            row > 0 &&
            matrix[row - 1][col] === '.' &&
            !visited[`${row - 1}-${col}`]
          )
            stack.push([row - 1, col]);
          if (
            row < n - 1 &&
            matrix[row + 1][col] === '.' &&
            !visited[`${row + 1}-${col}`]
          )
            stack.push([row + 1, col]);
          if (
            col > 0 &&
            matrix[row][col - 1] === '.' &&
            !visited[`${row}-${col - 1}`]
          )
            stack.push([row, col - 1]);
          if (
            col < m - 1 &&
            matrix[row][col + 1] === '.' &&
            !visited[`${row}-${col + 1}`]
          )
            stack.push([row, col + 1]);
        }

        if (isLake) {
          lakes.push(lake);
        }
      }
    }
  }

  lakes.sort((l1, l2) => l2.length - l1.length);
  let cnt = 0;

  lakes.forEach((lake, i) => {
    if (i >= k) {
      // transform
      lake.forEach(([i, j]) => {
        matrix[i][j] = '*';
        cnt++;
      });
    }
  });
  console.log(cnt);
  for (let i = 0; i < n; i++) {
    console.log(matrix[i].join(''));
  }
}

'use strict';

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

let inputString = '';
let currentLine = 0;

process.stdin.on('data', (inputStdin) => {
  inputString += inputStdin;
});

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

  main();
});

function readline() {
  return inputString[currentLine++];
}

// Make a Snippet for the code above this and then write your logic in main()
function main() {
  const [n, m, k] = readline().split(' ').map(Number);
  const isOcean = (x, y) => x === 0 || x === n - 1 || y === 0 || y === m - 1;
  let matrix = new Array(n);
  for (let i = 0; i < n; i++) {
    matrix[i] = readline().split('');
  }

  let visited = {};
  let lakes = [];

  for (let i = 0; i < n; i++) {
    for (let j = 0; j < m; j++) {
      if (matrix[i][j] === '.' && !visited[`${i}-${j}`]) {
        let stack = [[i, j]];
        let lake = [];
        let isLake = true;
        while (stack.length) {
          const [row, col] = stack.pop();
          visited[`${row}-${col}`] = true;
          lake.push([row, col]);
          if (isOcean(row, col)) isLake = false;
          if (
            row > 0 &&
            matrix[row - 1][col] === '.' &&
            !visited[`${row - 1}-${col}`]
          )
            stack.push([row - 1, col]);
          if (
            row < n - 1 &&
            matrix[row + 1][col] === '.' &&
            !visited[`${row + 1}-${col}`]
          )
            stack.push([row + 1, col]);
          if (
            col > 0 &&
            matrix[row][col - 1] === '.' &&
            !visited[`${row}-${col - 1}`]
          )
            stack.push([row, col - 1]);
          if (
            col < m - 1 &&
            matrix[row][col + 1] === '.' &&
            !visited[`${row}-${col + 1}`]
          )
            stack.push([row, col + 1]);
        }

        if (isLake) {
          lakes.push(lake);
        }
      }
    }
  }

  lakes.sort((l1, l2) => l2.length - l1.length);
  let cnt = 0;

  lakes.forEach((lake, i) => {
    if (i >= k) {
      // transform
      cnt++;
      lake.forEach(([i, j]) => {
        matrix[i][j] = '*';
      });
    }
  });
  console.log(cnt);
  for (let i = 0; i < n; i++) {
    console.log(matrix[i].join(''));
  }
}


The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.To make sure that the number a fits on the piece of paper, the Little Elephant ought to delete exactly one any digit from number a in the binary record. At that a new number appears. It consists of the remaining binary digits, written in the corresponding order (possible, with leading zeroes).The Little Elephant wants the number he is going to write on the paper to be as large as possible. Help him find the maximum number that he can obtain after deleting exactly one binary digit and print it in the binary notation.

The single line contains integer a, written in the binary notation without leading zeroes. This number contains more than 1 and at most 105 digits.

In the single line print the number that is written without leading zeroes in the binary notation — the answer to the problem.

NoteIn the first sample the best strategy is to delete the second digit. That results in number 112 = 310.In the second sample the best strategy is to delete the third or fourth digits — that results in number 110102 = 2610.

let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}

// utils
const MOD = 1e9 + 7;
const mod = (n) => ((n % MOD) + MOD) % MOD;
const add = (a, b) => mod(mod(a) + mod(b));
const sub = (a, b) => mod(mod(a) - mod(b));
function mul() {
  for (var a = arguments, r = a[0], i = a.length; --i; )
    r = ((((r >> 16) * a[i]) % MOD) * 65536 + (r & 65535) * a[i]) % MOD;
  return r;
}
function inv(b) {
  for (var a = MOD, u = 0, v = 1, t; b; v = t)
    (t = (a / b) | 0), (a -= t * b), (u -= t * v), (t = a), (a = b), (b = t), (t = u), (u = v);
  u %= MOD;
  return u < 0 ? u + MOD : u;
}
function pow(base, n) {
  if (n === 0) return 1;
  let p = pow(base, Math.floor(n / 2));
  let res = mul(mod(p), mod(p));
  if (n % 2 === 1) res = mul(mod(res), base);
  return res;
}
function highestOneBit(i) {
  i |= i >> 1;
  i |= i >> 2;
  i |= i >> 4;
  i |= i >> 8;
  i |= i >> 16;
  return i - (i >>> 1);
}
function permutation(arr, len, store = "", permutations = []) {
  if (store.length === len) {
    permutations.push(store);
    return;
  }
  for (let i = 0; i < arr.length; i++) {
    const newArr = [...arr];
    const newChar = newArr.splice(i, 1);
    permutation(newArr, len, store.concat(newChar), permutations);
  }
  return permutations;
}

function main() {
  const str = readLine();
  let found = false;
  let res = "";

  for (let i = 0; i < str.length; i++) {
    const char = str[i];
    if (char === "0" && !found) {
      found = true;
      continue;
    }
    res += char;
  }

  if (!found) console.log(res.slice(0, -1));
  else console.log(res);
}

if (!this.readline) print = console.log, readline = require('./readline');

function readNums() {
	return readline().split(' ').map(Number);
}

var a = readline().split('');
var ans = [];
var f = false;
for (var i = 0; i < a.length; i++) {
	if (!f && a[i] === '0') {
		f = true;
	} else {
		ans.push(a[i]);
	}
}
if (!f) {
	ans.pop();
}
print(ans.join(''));

;(function () {

	var s = readline().replace(/^0*/, '');
	var ns = s.replace(/0/, '');
	print( ns.length != s.length ? ns : s.replace(/1/, '') );

}).call(this);

function main(){

var num = readline();
var length = num.length;

var zloc=-1;

for(i=0;i<length;i++){
    if(num[i]==='0'){
	zloc=i;
	break;
    }
}

if(zloc===-1){
    print(num.slice(1,length));
    return;
}

print(num.slice(0,zloc)+num.slice(zloc+1,length));

}

main();

;(function () {

	print( readline().replace(/^0*/, '').replace(/0/, '') );

}).call(this);