int LargButMinFreq(int arr[], int n) {
// code here
priority_queue<int> pq;
for(int i = 0; i < n ; i++){
pq.push(arr[i]);
}
int ans = 0,minFreq = INT_MAX;
while(!pq.empty()){
int val = pq.top(),freq = 1;
pq.pop();
while(!pq.empty() && pq.top() == val){
pq.pop() , freq++;
}
if(freq < minFreq)
minFreq = freq, ans = val;
}
return ans;
}