Salem gave you n sticks with integer positive lengths a_1, a_2, …, a_n.

For every stick, you can change its length to any other positive integer length (that is, either shrink or stretch it). The cost of changing the stick's length from a to b is |a - b|, where |x| means the absolute value of x.

A stick length a_i is called almost good for some integer t if |a_i - t| ≤ 1.

Salem asks you to change the lengths of some sticks (possibly all or none), such that all sticks' lengths are almost good for some positive integer t and the total cost of changing is minimum possible. The value of t is not fixed in advance and you can choose it as any positive integer. 

As an answer, print the value of t and the minimum cost. If there are multiple optimal choices for t, print any of them.

Input

The first line contains a single integer n (1 ≤ n ≤ 1000) — the number of sticks.

The second line contains n integers a_i (1 ≤ a_i ≤ 100) — the lengths of the sticks.

Output

Print the value of t and the minimum possible cost. If there are multiple optimal choices for t, print any of them.

Examples

Input


3
10 1 4


Output


3 7


Input


5
1 1 2 2 3


Output


2 0

Note

In the first example, we can change 1 into 2 and 10 into 4 with cost |1 - 2| + |10 - 4| = 1 + 6 = 7 and the resulting lengths [2, 4, 4] are almost good for t = 3.

In the second example, the sticks lengths are already almost good for t = 2, so we don't have to do anything.



import java.util.*;
import java.lang.*;
import java.lang.reflect.Array;
import java.io.*;
import java.util.HashMap;
import java.io.BufferedReader; 
import java.io.FileReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer; 
import java.io.DataInputStream; 
import java.io.FileInputStream; 
public class Prac {
    public static int min(int a,int b,int c){
        if(a<b){
            if(a<c)
                return a;
            
            else
                return c;
        }
        else{
            if(b<c)
                return b;
            else
                return c;
        }   
}
    public static int max(int a,int b,int c){
        if(a<b){
            if(b<c)
                return c;
            
            else
                return b;
        }
        else{
            if(a<c)
                return c;
            else
                return a;
        }   
}
    static class InputReader {
 
		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
 
		public InputReader(InputStream st) {
			this.stream = st;
		}
 
		public int read() {
			if (snumChars == -1)
	 			throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
 
		public int ni() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
 
		public long nl() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
 
		public int[] nia(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = ni();
			}
			return a;
		}
 
		public String rs() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
 
		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}
 
		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
 
		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
 
	}
    static abstract class MultiSetImpl<ValueType, MapType extends Map<ValueType, Integer>> implements MultiSet<ValueType> {
        protected final MapType map;
        protected int size;
        protected int distinctCount;

        protected MultiSetImpl(MapType map) {
            this.map = map;
            this.size = 0;
        }

        public void add(ValueType value) {
            int count = getCount(value);
            if (count == 0) ++distinctCount;
            map.put(value, count + 1);
            ++size;
        }

        public boolean remove(ValueType value) {
            int count = getCount(value);
            if (count == 0) return false;

            if (count == 1) map.remove(value);
            else map.put(value, count - 1);
            if (count == 1) --distinctCount;
            --size;
            return true;
        }

        public int getCount(ValueType value) {
            Integer count = map.get(value);
            return (count == null ? 0 : count);
        }

        @Override
        public String toString() {
            StringBuilder stringBuilder = new StringBuilder();
            for (ValueType key : map.keySet()) {
                stringBuilder.append("[" + key.toString() + " " + map.get(key).toString() + "] ");
            }
            return stringBuilder.toString();
        }

    }

    static interface MultiSet<ValueType> {
    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        private int pread() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = pread();
            while (isSpaceChar(c))
                c = pread();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = pread();
            }
            int res = 0;
            do {
                if (c == ',') {
                    c = pread();
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = pread();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }

    static class HashMultiSet<ValueType> extends MultiSetImpl<ValueType, Map<ValueType, Integer>> {
        public HashMultiSet(Map<ValueType, Integer> map) {
            super(map);
        }

    }

  static long modInverse(long a, long m){
      long num=m;
      long x=1;
      long power=a;
      while(num>0){
          if(num%2==1){
              x=(x*power)%mod;
          }
         num=num/2;
         power=(power*power)%mod;
         
      }
      return x;
  }
   public static void findFact(){
         fact[0]=1;
         for(int i=1;i<=1000000;i++){
             fact[i]=(i*fact[i-1])%mod;
         }
     }
public static long fact[]=new long[1000005];
    
    static PrintWriter w = new PrintWriter(System.out);
     static long mod=1000000007;
     
    
    public static void main(String[] args) throws IOException {        InputReader sc=new InputReader(System.in);
        //Scanner sc=new Scanner(System.in);
        //HashMultiSet<Integer> multiSet = new HashMultiSet<>(new HashMap<>());
       //StringBuilder stringBuilder = new StringBuilder();
       
       int n=sc.ni();
       int arr[]=new int[n];
       int i=0;
       for(i=0;i<n;i++)
           arr[i]=sc.ni();
       int ans[]=new int[102];
       int j=0;
       int count=0;
       int min=1000000000;
       for(i=0;i<102;i++){
           ans[i]=1000000000;
       }
       for(i=1;i<=101;i++){
           count=0;
           for(j=0;j<n;j++){
               if(arr[j]>i&&Math.abs(arr[j]-i)>1){
                   count+=arr[j]-i-1;
               }
               else if(arr[j]<i&&Math.abs(arr[j]-i)>1)
                   count+=i-arr[j]-1;
          
           }
           ans[i]=count;
       }
       int sol=0;
       int index=0;
       for(i=0;i<=101;i++){
           if(ans[i]<min){
               index=i;
               sol=ans[i];
               min=ans[i];
           }
       }
       w.println(index+" "+sol);
       w.close();
    }  
}