program sothuk;
var A,B:array[1..100] of integer;
n,i,j,tg,k:integer;
begin
clrscr;
write('Nhap so luong phan tu cua day: '); readln(n);
writeln('Nhap gia tri tung phan tu cua day');
for i:=1 to n do
begin
write('Phan tu thu ',i,': ');
readln(A[i]);
end;
write('Nhap k: '); readln(k);
{Sap xep}
for i:=1 to n do
for j:=i+1 to n do
if A[i]<A[j] then
begin
tg:=A[i];
A[i]:=A[j];
A[j]:=tg;
end;
{Tao mang tim vi thu}
B[1]:=1;
for i:=2 to n do
if A[i]=A[i-1] then B[i]:=B[i-1] else B[i]:=i;
{In vi thu cua A[k]}
write('Phan tu ',A[k],' co vi thu: ',B[k]);
readln
end.