#include <iostream>
using namespace std;

template<class Item>
class PQ{
private:
	Item *pq;	/*Массив элементов*/
	int n;		/*Текущее оличество элементов в очереди*/
	int max;	/*Максимальное количество элементов в очереди*/
public:
	PQ(int max){
		pq = new Item[max];
		n = 0;
		this->max = max;
	}

	~PQ(){
		delete[] pq;
	}

	int empty() const{ return n == 0; }

	/*Функция добавления элемента, поддерживающая упорядоченность массива*/
	void insert(Item item){
		if(n+1 < max){
			int location = n - 1;

			while(location >= 0 && pq[location] > item){
				pq[location + 1] = pq[location];
				location = location - 1;
			}
			pq[location + 1] = item;
			n++;
		}
		//pq[n++] = item;
	}

};

int main() {
	// your code goes here
	return 0;
}