Under construction

Still being built. Things may change

Wrong Bubble Sort

Interview

Time limit1sMemory limit1024 MB

Summary
Given N, output a length-N array of values from 0 to 10000 that Jeongyeon's bubble sort fails to sort correctly.
Level

Medium5 of 10

Topics
Sorting, Simulation
Solved
No attempts yet

Problem

Jeongyeon learned bubble sort in a school programming class and wanted to put it to use, so she took on a sorting problem on an online judge. The problem was as follows.

"Given a sequence of NN numbers A0A_0, A1A_1, ⋯\cdots, AN−1A_{N-1}, write a program that sorts them in ascending order."

Jeongyeon thought her code was perfect and submitted it, but unfortunately got "Wrong answer." Her bubble sort code is shown below.

for (int i = N - 1; i > 0; i--) {
    for (int j = i - 1; j >= 0; j--) {
        if (A[j] > A[j + 1]) {
            int tmp = A[j];
            A[j] = A[j + 1];
            A[j + 1] = tmp;
        }
    }
}

Given NN, construct a counterexample input for Jeongyeon's code. Specifically, build a sequence AA of length NN that her code does not sort correctly. Every element of AA must be an integer from 00 to 10 00010\,000, inclusive, and her code must fail to sort the NN numbers you output.

Such a sequence exists for every NN that satisfies the input constraints. If several sequences work, print any of them.

Input

The first line contains an integer NN.

Output

On the first line, print NN integers A0A_0, A1A_1, ⋯\cdots, AN−1A_{N-1} separated by spaces that satisfy the conditions above.

Limits

  • 3≤N≤1 0003 \le N \le 1\,000
  • 0≤Ai≤10 0000 \le A_i \le 10\,000 (0≤i<N0 \le i < N)

Examples1

  1. Example 1

    Input
    3
    
    Expected output
    3 1 2