// goodwincommaderek@gmail.com import java.util.Scanner; public class duelofcards_dg_ac { // to game the system in favor of one player or the other, // greedily assume that the player we want to win does so by the slimmest margin possible public static void main(String[] args) { Scanner in = new Scanner(System.in); int N = in.nextInt(); boolean[] aliceCard = new boolean[N + N]; for (int n = 0; n < N; n++) { int card = in.nextInt() - 1; aliceCard[card] = true; } int minWins, maxWins; // solve the minimum { int b = 0; int numLosses = 0; for(int a = 0; a < N+N; a++) { if (!aliceCard[a]) { continue; } // a is alice's card b = Math.max(a+1,b); while(b < N+N && aliceCard[b]) { b++; } if (b == N+N) break; // b is bob's card // b is guaranteed to be greater than a, so alice loses numLosses++; // don't use b again b++; } minWins = N - numLosses; } // solve the maximum { int a = 0; int numWins = 0; for(int b = 0; b < N+N; b++) { if (aliceCard[b]) { continue; } // b is bob's card a = Math.max(b+1, a); while(a < N+N && !aliceCard[a]) { a++; } if (a == N+N) break; // a is alice's card // a is guaranteed to be greater than b, so alice wins numWins++; // don't use a again a++; } maxWins = numWins; } System.out.println(minWins+" "+maxWins); } }