import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        HashMap<Integer, Integer> k = new HashMap<>();

        for(int i = 0; i < n; i++){
            int y = sc.nextInt();
			//while taking the input itself putting into the map
			// so automatically increments the freq
            k.put(y, k.getOrDefault(y, 0) + 1);
        }
		//taking the max value for minFreq so that when we get min value we update it
        int minFrequency= Integer.MAX_VALUE, maxFrequency = 0;
        int minElement = -1, maxElement = -1;

        for(Map.Entry<Integer, Integer> itr : k.entrySet()){
            int number = itr.getKey();
            int count = itr.getValue();

            if(count < minFrequency){
                minFrequency = count;
                minElement = number;
            }

            if(count > maxFrequency ){
                maxFrequency = count;
                maxElement = number;
            }
        }

        System.out.println("minimum freq having Element is "+ " " + minFrequency );
        System.out.println("maximum freq having Element is "+ " " + maxFrequency);
    }
}