class Solution {
public int findLucky(int[] arr) {
int[] result = new int[501];
for(int i = 0; i < arr.length; i++){
result[arr[i]]++;
}
for(int i = 500; i > 0; i--){
if(result[i] == i) return i;
}
return -1;
}
}