#include <vector>
#include <iostream>
using namespace std;
int main() {
    size_t n;
    int korz;
    cerr << "Number of elem ";
    cin >> n;
    vector<float> vec(n);
    for (size_t i = 0; i < vec.size(); i++) {
        //cout << i + 1 << ".";
        cin >> vec[i];
    }
    cerr << "Number of baskets ";
    cin >> korz;
    vector<size_t> bins(korz);
    double mn = vec[0];
    double mx = vec[0];
    for (double x : vec) {
        if (x < mn) {
            mn = x;
        }
        else if (x > mx) {
            mx = x;
        }
    }
    float bin_size = (mx - mn) / korz;
    for (size_t i = 0; i < vec.size(); i++) {
        bool fl = false;
        for (size_t j = 0; (j < korz - 1) && !fl; j++) {
            auto lo = mn + j * bin_size;
            auto hi = mn + (j + 1) * bin_size;
            if ((lo <= vec[i]) && (vec[i] < hi)) {
                bins[j]++;
                fl = true;
            }
        }
        if (!fl) {
            bins[korz - 1]++;

        }
    }
    bool gigant = false;
    auto spaces = 0;
    size_t mx_count = 0;
    for (auto x : bins) {
        if (x > 76) {
            gigant = true;
        }
        if (x > mx_count) {
            mx_count = x;
        }
        auto len = 0;
        while (x > 0) {
            x /= 10;
            len++;
        }
        if (len > spaces) {
            spaces = len;
        }

    }
    if (spaces == 1) {
        for (size_t i = 0; i < bins.size(); i++) {
            cout << "  " << bins[i] << "|";
            if (gigant) {
                if (bins[i] == mx_count) {
                    for (size_t j = 0; j < 76; j++) {
                        cout << "*";
                    }
                }
                else
                {
                    for (size_t j = 0; j < 76 * static_cast<double>(bins[i]) / mx_count; j++) {
                        cout << "*";
                    }
                }
            }
            else
            {
                for (size_t j = 0; j < bins[i]; j++) {
                    cout << "*";
                }
                cout << endl;
            }
        }
    }
    else
    {
        for (size_t i = 0; i < bins.size(); i++) {
            int len = 1;
            int k = bins[i];
            for (; k /= 10; ++len);
            while (len < spaces) {
                cout << " ";
                len++;
            }
            cout << bins[i];
            cout << "|";
            if (gigant) {
                if (bins[i] == mx_count) {
                    for (size_t j = 0; j < 76; j++) {
                        cout << "*";
                    }
                }
                else
                {
                    for (size_t j = 0; j < (76 * static_cast<double>(bins[i]) / mx_count - 1); j++) {
                        cout << "*";
                    }
                }
            }
            else
            {
                for (size_t j = 0; j < bins[i]; j++) {
                    cout << "*";
                }
            }
            cout << endl;
        }
    }
}