#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

// Function to compare two integers for qsort
int compare(const void *a, const void *b) {
    return ((int)a - (int)b);
}

int main() {
    int n;
    if (scanf("%d", &n) != 1 || n < 1 || n > 100) {
        printf("Invalid input\n");
        return 1;
    }

    int batch_results = (int)malloc(n * sizeof(int));
    if (batch_results == NULL) {
        printf("Memory allocation failed\n");
        return 1;
    }

    int valid_inputs = 1;
    for (int i = 0; i < n; i++) {
        if (scanf("%d", &batch_results[i]) != 1) {
            valid_inputs = 0;
            break;
        }
    }

    if (!valid_inputs) {
        printf("Invalid input\n");
        free(batch_results);
        return 1;
    }

    // Sort the batch results
    qsort(batch_results, n, sizeof(int), compare);

    // Print the sorted batch results
    for (int i = 0; i < n; i++) {
        printf("%d ", batch_results[i]);
    }
    printf("\n");

    // Print the smallest and largest readings
    printf("Smallest: %d\n", batch_results[0]);
    printf("Largest: %d\n", batch_results[n-1]);

    free(batch_results);
    return 0;
}