```
public String[] findRelativeRanks(int[] nums) {
int n = nums.length;
int[] rank = new int[n];
for (int i = 0; i < n-1; i++) {
for (int j = i+1; j < n; j++) {
if (nums[i] > nums[j]) rank[i]++;
else rank[j]++;
}
}
String[] res = new String[n];
for (int i = 0; i < rank.length; i++) {
if (rank[i] == n-1) res[i] = "Gold Medal";
else if (rank[i] == n-2) res[i] = "Silver Medal";
else if (rank[i] == n-3) res[i] = "Bronze Medal";
else res[i] = String.valueOf(n-rank[i]);
}
return res;
}
```