#include <iostream>
using std::cout;
using std::cin;
using std::endl;

void bubble(int *a, int n)
{
	for(int i = n - 1; i >= 0; i--)
	{
		for(int j = 0; j<i; j++)
		{
			if(a[j] < a[j + 1]) //Если поменять знак на ">", то будет сортировка по возрастанию
			{
				int tmp = a[j];
				a[j] = a[j + 1];
				a[j + 1] = tmp;
			}
		}
	}
}

int main()
{
	int arraySize;
	int *a;

	cout << "Enter the array size: ";
	cin >> arraySize;
	cout << "Enter the " << arraySize << " numbers: ";

	a = new int[arraySize];

	for(int i = 0; i < arraySize; i++)
	{
		cin >> a[i];
	}

	bubble(a, arraySize);

	for(int i = 0; i < 3; i++)
	{
		cout << a[i] << " ";
	}

	cout << endl;

	delete[] a;

	cin.get();
	return 0;
}