using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;


namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int rozmiar = 100;
            Random r = new Random();
            List<int> a = new List<int>(new int[rozmiar]);
            for (int i = 0; i < rozmiar; i++) a[i] = r.Next(100);
            a.AddRange(new int[10]);
            int[] i5 ={ -1, -1, -1, -1, -1 };
            a.InsertRange(rozmiar / 2, i5);
            a.Insert(0, 1);

            for (int i = 0; i < a.Count; i++)
            {
                if ((int)a[i] > 20)
                {
                    a.RemoveAt(i);
                    i--;
                }
            }

            a.Sort();
            foreach (object ai in a) listBox1.Items.Add("" + ai);
        }
    }
}