#include #include #include #include using namespace std; int main() { vector heights; int H, N; scanf("%d%d", &H, &N); heights.push_back(H); for (int i = 1; i < N; i++) { int hi; scanf("%d", &hi); heights.push_back(hi); } sort(heights.begin(), heights.end(), greater()); int rank; for (int i = 0; i < N; i++) { if (heights[i] == H) { rank = i + 1; break; } } if (rank % 10 == 1) printf("%dst\n", rank); else if (rank % 10 == 2) printf("%dnd\n", rank); else if (rank % 10 == 3) printf("%drd\n", rank); else printf("%dth\n", rank); }