import java.io.*;
import java.util.*;

public class Solution {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        if(n<1)
            return;
        
        int[] X = new int[n];
        int sum = 0;
        HashMap<Integer, Integer> h = new HashMap<>();
        for(int i=0;i<n;i++){
            X[i] = s.nextInt();
            sum+=X[i];
            if(h.containsKey(X[i])){
                int c = h.get(X[i]);
                h.put(X[i],++c);
            }
            else{
                h.put(X[i],1);
            }
        }
        
        Arrays.sort(X);
        
        float mean = (float)sum/n;
        float median = (n%2==0)?(float)(X[n/2]+X[(n/2)-1])/2:X[n/2];
               
        HashMap.Entry<Integer, Integer> entry = h.entrySet().iterator().next();
        int mode = entry.getKey();
        int maxModeVal = entry.getValue();
        
        Iterator it = h.entrySet().iterator();
        while (it.hasNext()) {
            Map.Entry pair = (Map.Entry)it.next();
            
            int v = (int)pair.getValue();
            if(v >= maxModeVal){
                maxModeVal = Math.max(v, maxModeVal);
                int t_mode = (int)pair.getKey();
                mode = Math.min(mode, t_mode);
            }
        }
        System.out.println(mean);
        System.out.println(median);
        System.out.println(mode);
    }
}

@@ -1067,32 +1067,64 @@
 ();%0A            
+int t_mode = (int)pair.getKey();
 %0A            int
@@ -1124,17 +1124,21 @@
     int 
-v
+t_val
  = (int)
@@ -1173,12 +1173,15 @@
  if(
-v
+t_val
  %3E
-=
  max
@@ -1228,17 +1228,21 @@
 ath.max(
-v
+t_val
 , maxMod
@@ -1268,40 +1268,76 @@
     
-int
+mode =
  t_mode
- = (int)pair.getKey();
+;%0A            %7D%0A            else if(t_val==maxModeVal)%7B
 %0A   
@@ -1370,17 +1370,16 @@
 in(mode,
- 
 t_mode);

Update meanMedianMode.java