#include <time.h>
#include <stdio.h>
#include <stdlib.h>

void main(int argc, char *argv[])
{
    srand(time(NULL));
    
    long int i, j, aux;
    long int n = atoi(argv[1]);
    long int vetor[n];
    
    // vetor ordenado
    for (i=0; i<n; i++) {
        vetor[n-i-1] = i;
    }
    
    // vetor quase ordenado
    int k = 50;
    
    for (i=0; i<=n-k; i++) {
        j = i+rand()%k;
        aux = vetor[i];
        vetor[i] = vetor[j];
        vetor[j] = aux;
    }
    
    for (i=0; i<n-1; i++) {
        printf("%ld\n", vetor[i]);
    }
    printf("%ld", vetor[i]);
}