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

public class GenericProblem
{
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

	public static int MOD = 1000000007;
	public static void main(String[] args)
	{
		FastReader file = new FastReader();
		PrintWriter out = new PrintWriter(System.out);

		// Use long to avoid overflow
		int n = file.nextInt();
		long[] arr = new long[n];

		for (int i = 0; i < n; i++)
		{
			arr[i] = file.nextInt();
		}

		Arrays.sort(arr);

		if (n == 1)
		{
			out.println(-1);
			out.close();
			return;
		}
		if (n == 2)
		{
			long dist = arr[0] - arr[1];
			if (dist == 0)
			{
				out.println(1);
				out.println(arr[0]);
				out.close();
				return;
			}
			if ((dist) % 2 != 0)
			{
				out.println(2);

				out.println(arr[0] + dist + " " + (arr[1] - dist));
				out.close();
				return;
			}
			out.println(3);
			out.print(arr[0] + dist + " ");
			out.print((arr[0] + arr[1]) / 2 + " ");
			out.println(arr[1] - dist);
			out.close();
			return;
		}

		Map<Long, Integer> map = new HashMap<>();
		for (int i = 0; i < n - 1; i++)
		{
			if (!map.containsKey(arr[i] - arr[i + 1]))
				map.put(arr[i] - arr[i + 1], 0);

			map.put(arr[i] - arr[i + 1], map.get(arr[i] - arr[i + 1]) + 1);
		}

		int count = 0;

		for (long diff : map.keySet())
		{
			if (map.get(diff) > 1)
			{
				count++;
			}
		}

		if (count > 1 || map.size() > 2)
		{
			out.println(0);
			out.close();
			return;
		}

		if (map.size() == 1)
		{
			if (map.keySet().iterator().next() == 0)
			{
				out.println(1);
				out.println(arr[n - 1]);
				out.close();
				return;
			}
			out.println(2);
			out.print(arr[0] + map.keySet().iterator().next() + " ");
			out.println(arr[n - 1] - map.keySet().iterator().next());
			out.close();
			return;
		}
		Iterator<Long> it = map.keySet().iterator();
		long z = it.next();
		long tgt = map.get(z) == 1 ? z : it.next();
		long tgt2 = tgt == z ? it.next() : z;

		if (count == 0)
		{
			long oldTgt = tgt;
			long oldTgt2 = tgt2;

			tgt = Math.min(oldTgt, oldTgt2);
			tgt2 = Math.max(oldTgt, oldTgt2);
		}

		if (tgt % 2 != 0 || tgt == 0 || tgt2 == 0 || -tgt2 * 2 != -tgt ) // If this is odd
		{
			out.println(0);
			out.close();
			return;
		}

		out.println(1);

		for (int i = 0; i < n - 1; i++)
		{
			if (arr[i] - arr[i + 1] == tgt)
			{
				out.println((arr[i] + arr[i + 1]) / 2);
				break;
			}
		}

		out.close();
	}
}


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

public class GenericProblem
{
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

	public static int MOD = 1000000007;
	public static void main(String[] args)
	{
		FastReader file = new FastReader();
		PrintWriter out = new PrintWriter(System.out);

		// Use long to avoid overflow
		int n = file.nextInt();
		long[] arr = new long[n];

		for (int i = 0; i < n; i++)
		{
			arr[i] = file.nextInt();
		}

		Arrays.sort(arr);

		if (n == 1)
		{
			out.println(-1);
			out.close();
			return;
		}
		if (n == 2)
		{
			long dist = arr[0] - arr[1];
			if (dist == 0)
			{
				out.println(1);
				out.println(arr[0]);
				out.close();
				return;
			}
			if ((dist) % 2 != 0)
			{
				out.println(2);

				out.println(arr[0] + dist + " " + (arr[1] - dist));
				out.close();
				return;
			}
			out.println(3);
			out.print(arr[0] + dist + " ");
			out.print((arr[0] + arr[1]) / 2 + " ");
			out.println(arr[1] - dist);
			out.close();
			return;
		}

		Map<Long, Integer> map = new HashMap<>();
		for (int i = 0; i < n - 1; i++)
		{
			if (!map.containsKey(arr[i] - arr[i + 1]))
				map.put(arr[i] - arr[i + 1], 0);

			map.put(arr[i] - arr[i + 1], map.get(arr[i] - arr[i + 1]) + 1);
		}

		int count = 0;

		for (long diff : map.keySet())
		{
			if (map.get(diff) > 1)
			{
				count++;
			}
		}

		if (count > 1 || map.size() > 2)
		{
			out.println(0);
			out.close();
			return;
		}

		if (map.size() == 1)
		{
			if (map.keySet().iterator().next() == 0)
			{
				out.println(1);
				out.println(arr[n - 1]);
				out.close();
				return;
			}
			out.println(2);
			out.print(arr[0] + map.keySet().iterator().next() + " ");
			out.println(arr[n - 1] - map.keySet().iterator().next());
			out.close();
			return;
		}
		Iterator<Long> it = map.keySet().iterator();
		long z = it.next();
		long tgt = map.get(z) == 1 ? z : it.next();
		long tgt2 = tgt == z ? it.next() : z;

		if (tgt % 2 != 0 || tgt == 0 || tgt2 * 2 != tgt ) // If this is odd
		{
			out.println(0);
			out.close();
			return;
		}

		out.println(1);

		for (int i = 0; i < n - 1; i++)
		{
			if (arr[i] - arr[i + 1] == tgt)
			{
				out.println((arr[i] + arr[i + 1]) / 2);
				break;
			}
		}

		out.close();
	}
}


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

public class GenericProblem
{
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

	public static int MOD = 1000000007;
	public static void main(String[] args)
	{
		FastReader file = new FastReader();
		PrintWriter out = new PrintWriter(System.out);

		// Use long to avoid overflow
		int n = file.nextInt();
		long[] arr = new long[n];

		for (int i = 0; i < n; i++)
		{
			arr[i] = file.nextInt();
		}

		Arrays.sort(arr);

		if (n == 1)
		{
			out.println(-1);
			out.close();
			return;
		}
		if (n == 2)
		{
			long dist = arr[0] - arr[1];
			if (dist == 0)
			{
				out.println(1);
				out.println(arr[0]);
				out.close();
				return;
			}
			if ((arr[0] - arr[1]) % 2 == 1)
			{
				out.println(2);

				out.println(arr[0] + dist + " " + (arr[1] - dist));
				out.close();
				return;
			}
			out.println(3);
			out.print(arr[0] + dist + " ");
			out.print((arr[0] + arr[1]) / 2 + " ");
			out.println(arr[1] - dist);
			out.close();
			return;
		}

		Map<Long, Integer> map = new HashMap<>();
		for (int i = 0; i < n - 1; i++)
		{
			if (!map.containsKey(arr[i] - arr[i + 1]))
				map.put(arr[i] - arr[i + 1], 0);

			map.put(arr[i] - arr[i + 1], map.get(arr[i] - arr[i + 1]) + 1);
		}

		int count = 0;

		for (long diff : map.keySet())
		{
			if (map.get(diff) > 1)
			{
				count++;
			}
		}

		if (count > 1 || map.size() > 2)
		{
			out.println(0);
			out.close();
			return;
		}

		if (map.size() == 1)
		{
			if (map.keySet().iterator().next() == 0)
			{
				out.println(1);
				out.println(arr[n - 1]);
				out.close();
				return;
			}
			out.println(2);
			out.print(arr[0] + map.keySet().iterator().next() + " ");
			out.println(arr[n - 1] - map.keySet().iterator().next());
			out.close();
			return;
		}
		Iterator<Long> it = map.keySet().iterator();
		long z = it.next();
		long tgt = map.get(z) == 1 ? z : it.next();
		long tgt2 = tgt == z ? it.next() : z;

		if (tgt % 2 == 1 || tgt == 0 || tgt2 * 2 != tgt ) // If this is odd
		{
			out.println(0);
			out.close();
			return;
		}

		out.println(1);

		for (int i = 0; i < n - 1; i++)
		{
			if (arr[i] - arr[i + 1] == tgt)
			{
				out.println((arr[i] + arr[i + 1]) / 2);
				break;
			}
		}

		out.close();
	}
}


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

public class GenericProblem
{
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

	public static int MOD = 1000000007;
	public static void main(String[] args)
	{
		FastReader file = new FastReader();
		PrintWriter out = new PrintWriter(System.out);

		// Use long to avoid overflow
		int n = file.nextInt();
		long[] arr = new long[n];

		for (int i = 0; i < n; i++)
		{
			arr[i] = file.nextInt();
		}

		Arrays.sort(arr);

		if (n == 1)
		{
			out.println(-1);
			out.close();
			return;
		}
		if (n == 2)
		{
			long dist = arr[0] - arr[1];
			if ((arr[0] - arr[1]) % 2 == 1)
			{
				out.println(2);

				out.println(arr[0] + dist + " " + (arr[1] - dist));
				out.close();
				return;
			}
			out.println(3);
			out.print(arr[0] + dist + " ");
			out.print((arr[0] + arr[1]) / 2 + " ");
			out.println(arr[1] - dist);
			out.close();
			return;
		}

		Map<Long, Integer> map = new HashMap<>();
		for (int i = 0; i < n - 1; i++)
		{
			if (!map.containsKey(arr[i] - arr[i + 1]))
				map.put(arr[i] - arr[i + 1], 0);

			map.put(arr[i] - arr[i + 1], map.get(arr[i] - arr[i + 1]) + 1);
		}

		int count = 0;

		for (long diff : map.keySet())
		{
			if (map.get(diff) > 1)
			{
				count++;
			}
		}

		if (count > 1 || map.size() > 2)
		{
			out.println(0);
			out.close();
			return;
		}

		if (map.size() == 1)
		{
			out.println(2);
			out.print(arr[0] + map.keySet().iterator().next() + " ");
			out.println(arr[n - 1] - map.keySet().iterator().next());
			out.close();
			return;
		}
		Iterator<Long> it = map.keySet().iterator();
		long z = it.next();
		long tgt = map.get(z) == 1 ? z : it.next();
		long tgt2 = tgt == z ? it.next() : z;

		if (tgt % 2 == 1 || tgt == 0 || tgt2 * 2 != tgt ) // If this is odd
		{
			out.println(0);
			out.close();
			return;
		}

		out.println(1);

		for (int i = 0; i < n - 1; i++)
		{
			if (arr[i] - arr[i + 1] == tgt)
			{
				out.println((arr[i] + arr[i + 1]) / 2);
				break;
			}
		}

		out.close();
	}
}


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class ArithmeticProgr {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] arr = new int[n];
		int[] ans = new int[n];
		ArrayList<String> ll = new ArrayList<>();
		// StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();

		}
		int c = 0;
		Arrays.sort(arr);

		int diff = (arr[n - 1] - arr[0]) / (arr.length);

		if (arr.length == 1) {
			System.out.println(-1);
			return;
		}

		int diff1 = arr[1] - arr[0];
		for (int i = 0; i < n - 1; i++) {
			if (Math.abs(arr[i] - arr[i + 1]) == diff1) {
				c++;
			}
		}
		if (c < n - 2) {
			System.out.println(0);
			return;
		}
		if (arr.length == 2) {
			if (c == n - 1) {
				ll.add(arr[0] + diff + " ");
			}
		}
		if (c != n - 1) {
			for (int i = 0; i < n - 1; i++) {
				if (Math.abs(arr[i] - arr[i + 1]) != diff && Math.abs(arr[i] - arr[i + 1]) == 2*diff) {
					ll.add((arr[i] + diff) + " ");
					break;
				}

			}
		}

		if (c == n - 1) {
			ll.add((arr[0] - diff1) + " ");
			for (int i = 0; i < n - 1; i++) {
				if (Math.abs(arr[i] - arr[i + 1]) != diff1) {
					ll.add((arr[i] + diff1) + " ");
					break;
				}
			}
			ll.add((arr[n - 1] + diff1) + " ");

		}
		System.out.println(ll.size());
		Collections.sort(ll);
		for (int i = 0; i < ll.size(); i++) {
			System.out.print(ll.get(i));
		}
	}

}


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class ArithmeticProgr {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] arr = new int[n];
		int[] ans = new int[n];
		ArrayList<String> ll = new ArrayList<>();
		// StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();

		}
		int c = 0,cn=0;;
		Arrays.sort(arr);

		int diff = (arr[n - 1] - arr[0]) / (arr.length);

		if (arr.length == 1) {
			System.out.println(-1);
			return;
		}

		int diff1 = arr[1] - arr[0];
		for (int i = 0; i < n - 1; i++) {
			if (Math.abs(arr[i] - arr[i + 1]) == diff1) {
				c++;
			}
		}

		if (arr.length == 2) {
			if(arr[0] == arr[1]) {
				System.out.println(1);
				System.out.println(arr[0]);
				return;
			}
			if (c == n - 1) {
				ll.add(arr[0] + diff + " ");
			}
		}
		if (c != n - 1) {
			for (int i = 0; i < n - 1; i++) {
				if (Math.abs(arr[i] - arr[i + 1]) != diff && Math.abs(arr[i] - arr[i + 1]) == 2*diff) {
					ll.add((arr[i] + diff) + " ");
					cn++;
					break;
				}

			}
		}
		if (c < n - 2 && cn==0) {

			System.out.println(0);
			return;
		}

		if (c == n - 1) {
			ll.add((arr[0] - diff1) + " ");
			for (int i = 0; i < n - 1; i++) {
				if (Math.abs(arr[i] - arr[i + 1]) != diff1) {
					ll.add((arr[i] + diff1) + " ");
					break;
				}
			}
			ll.add((arr[n - 1] + diff1) + " ");

		}
		System.out.println(ll.size());
		Collections.sort(ll);
		for (int i = 0; i < ll.size(); i++) {
			System.out.print(ll.get(i));
		}
	}

}


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class ArithmeticProgr {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] arr = new int[n];
		int[] ans = new int[n];
		ArrayList<String> ll = new ArrayList<>();
		// StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();

		}
		int c = 0;
		Arrays.sort(arr);

		int diff = (arr[n - 1] - arr[0]) / (arr.length);

		if (arr.length == 1) {
			System.out.println(-1);
			return;
		}

		int diff1 = arr[1] - arr[0];
		for (int i = 0; i < n - 1; i++) {
			if (Math.abs(arr[i] - arr[i + 1]) == diff1) {
				c++;
			}
		}
		if (c < n - 2) {
			System.out.println(0);
			return;
		}
		if (arr.length == 2) {
			if (c == n - 1) {
				ll.add(arr[0] + diff + " ");
			}
		}
		if (c != n - 1) {
			for (int i = 0; i < n - 1; i++) {
				if (Math.abs(arr[i] - arr[i + 1]) != diff) {
					ll.add((arr[i] + diff) + " ");
					break;
				}

			}
		}

		if (c == n - 1) {
			ll.add((arr[0] - diff1) + " ");
			for (int i = 0; i < n - 1; i++) {
				if (Math.abs(arr[i] - arr[i + 1]) != diff1) {
					ll.add((arr[i] + diff1) + " ");
					break;
				}
			}
			ll.add((arr[n - 1] + diff1) + " ");

		}
		System.out.println(ll.size());
		Collections.sort(ll);
		for (int i = 0; i < ll.size(); i++) {
			System.out.print(ll.get(i));
		}
	}

}


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class ArithmeticProgr {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] arr = new int[n];
		int[] ans = new int[n];
		ArrayList<Integer> ll = new ArrayList<>();
		// StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();

		}
		int c = 0, cn = 0;
		;
		Arrays.sort(arr);
		int diff = 0, chk = 0;
		;
		if ((arr[n - 1] - arr[0]) % (arr.length) == 0) {
			diff = (arr[n - 1] - arr[0]) / (arr.length);
			chk = 1;
		}

		if (arr.length == 1) {
			System.out.println(-1);
			return;
		}

		int diff1 = arr[1] - arr[0];
		for (int i = 0; i < n - 1; i++) {
			if (Math.abs(arr[i] - arr[i + 1]) == diff1) {
				c++;
			}
		}

		if (arr.length == 2) {
			if (arr[0] == arr[1]) {
				System.out.println(1);
				System.out.println(arr[0]);
				return;
			}
			if (c == n - 1 && chk == 1) {
				if (!ll.contains(arr[0] + diff + " "))
					ll.add(arr[0] + diff );
			}
		}
		if (c != n - 1 && chk == 1) {
			for (int i = 0; i < n - 1; i++) {
				if (Math.abs(arr[i] - arr[i + 1]) != diff && Math.abs(arr[i] - arr[i + 1]) == 2 * diff) {
					if (!ll.contains(arr[i] + diff + " ")) {

						ll.add((arr[i] + diff));
						cn++;
						break;
					}
				}

			}
		}
		if (c < n - 2 && cn == 0) {

			System.out.println(0);
			return;
		}

		if (c == n - 1) {
			ll.add((arr[0] - diff1));
			for (int i = 0; i < n - 1; i++) {
				if (Math.abs(arr[i] - arr[i + 1]) != diff1) {
					if (!ll.contains(arr[i] + diff1)) {
						ll.add((arr[i] + diff1));
						break;
					}
				}
			}
			if (!ll.contains(arr[n-1] + diff1 + " ")) {
				ll.add((arr[n - 1] + diff1));
			}

		}
		System.out.println(ll.size());

		Collections.sort(ll);

		for (int i = 0; i < ll.size(); i++) {
			System.out.print(ll.get(i)+" ");
		}
	}

}


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class ArithmeticProgr {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] arr = new int[n];
		int[] ans = new int[n];
		ArrayList<Integer> ll = new ArrayList<>();
		// StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();

		}
		int c = 0, cn = 0;
		;
		Arrays.sort(arr);
		int diff = 0, chk = 0;
		;
		if ((arr[n - 1] - arr[0]) % (arr.length) == 0) {
			diff = (arr[n - 1] - arr[0]) / (arr.length);
			chk = 1;
		}

		if (arr.length == 1) {
			System.out.println(-1);
			return;
		}

		int diff1 = arr[1] - arr[0];
		for (int i = 0; i < n - 1; i++) {
			if (Math.abs(arr[i] - arr[i + 1]) == diff1) {
				c++;
			}
		}

		if (arr.length == 2) {
			if (arr[0] == arr[1]) {
				System.out.println(1);
				System.out.println(arr[0]);
				return;
			}
			if (c == n - 1 && chk == 1) {
				if (!ll.contains(arr[0] + diff))
					ll.add(arr[0] + diff );
			}
		}
		if (c != n - 1 && chk == 1) {
			for (int i = 0; i < n - 1; i++) {
				if (Math.abs(arr[i] - arr[i + 1]) != diff && Math.abs(arr[i] - arr[i + 1]) == 2 * diff) {
					if (!ll.contains(arr[i] + diff)) {

						ll.add((arr[i] + diff));
						cn++;
						break;
					}
				}

			}
		}
		if (c < n - 2 && cn == 0) {

			System.out.println(0);
			return;
		}

		if (c == n - 1) {
			ll.add((arr[0] - diff1));
			for (int i = 0; i < n - 1; i++) {
				if (Math.abs(arr[i] - arr[i + 1]) != diff1) {
					if (!ll.contains(arr[i] + diff1)) {
						ll.add((arr[i] + diff1));
						break;
					}
				}
			}
			if (!ll.contains(arr[n-1] + diff1)) {
				ll.add((arr[n - 1] + diff1));
			}

		}
		System.out.println(ll.size());

		Collections.sort(ll);

		for (int i = 0; i < ll.size(); i++) {
			System.out.print(ll.get(i)+" ");
		}
	}

}


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class ArithmeticProgr {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] arr = new int[n];
		int[] ans = new int[n];
		ArrayList<String> ll = new ArrayList<>();
		// StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();

		}
		int c = 0,cn=0;;
		Arrays.sort(arr);

		int diff = (arr[n - 1] - arr[0]) / (arr.length);

		if (arr.length == 1) {
			System.out.println(-1);
			return;
		}

		int diff1 = arr[1] - arr[0];
		for (int i = 0; i < n - 1; i++) {
			if (Math.abs(arr[i] - arr[i + 1]) == diff1) {
				c++;
			}
		}

		if (arr.length == 2) {
			if (c == n - 1) {
				ll.add(arr[0] + diff + " ");
			}
		}
		if (c != n - 1) {
			for (int i = 0; i < n - 1; i++) {
				if (Math.abs(arr[i] - arr[i + 1]) != diff && Math.abs(arr[i] - arr[i + 1]) == 2*diff) {
					ll.add((arr[i] + diff) + " ");
					cn++;
					break;
				}

			}
		}
		if (c < n - 2 && cn==0) {

			System.out.println(0);
			return;
		}

		if (c == n - 1) {
			ll.add((arr[0] - diff1) + " ");
			for (int i = 0; i < n - 1; i++) {
				if (Math.abs(arr[i] - arr[i + 1]) != diff1) {
					ll.add((arr[i] + diff1) + " ");
					break;
				}
			}
			ll.add((arr[n - 1] + diff1) + " ");

		}
		System.out.println(ll.size());
		Collections.sort(ll);
		for (int i = 0; i < ll.size(); i++) {
			System.out.print(ll.get(i));
		}
	}

}


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

public class CFR2243 {
	public static void main (String[] args) {
		Scanner sc = new Scanner (System.in);
		PrintStream op = System.out;
		int N = sc.nextInt();
		int[] A = new int [N];
		for (int i = 0; i < N; i++)
			A[i] = sc.nextInt();
		if (N == 1) {
			op.println(-1);
			return;
		}
		Arrays.sort(A);
		int d = A[1] - A[0];
		boolean used = false;
		int ret = -1;
		for (int i = 2; i < N; i++) {
			if (A[i] - A[i - 1] != d) {
				if (used) {
					op.println(0);
					return;
				}
				else {
					used = true;
					ret = A[i - 1] + d;
					if (A[i] - ret != d) {
						op.println(0);
						return;
					}
				}
			}
		}
		if (used) {
			op.println(1);
			op.println(ret);
			return;
		}
		if (d == 0) {
			op.println(1);
			op.println(A[0]);
			return;
		}
		if (N == 2 && d > 1 && d % 2 == 0) {
			int d1 = d / 2;
			op.println(3);
			op.println((A[0] - d) + " " + (A[0] + d1) + " " + (A[1] + d));
			return;
		}
		op.println(2);
		op.println((A[0] - d) + " " + (A[N - 1] + d));
		sc.close();
	}
}


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

public class CFR2243 {
	public static void main (String[] args) {
		Scanner sc = new Scanner (System.in);
		PrintStream op = System.out;
		int N = sc.nextInt();
		int[] A = new int [N];
		for (int i = 0; i < N; i++)
			A[i] = sc.nextInt();
		sc.close();
		if (N == 1) {
			op.println(-1);
			return;
		}
		Arrays.sort(A);
		int d = A[1] - A[0];
		boolean used = false;
		int ret = -1;
		boolean isP = true;
		for (int i = 2; i < N; i++) {
			if (A[i] - A[i - 1] != d) {
				if (used) {
					isP = false;
					break;
				}
				else {
					used = true;
					ret = A[i - 1] + d;
					if (A[i] - ret != d) {
						isP = false;
						break;
					}
				}
			}
		}
		if (used) {
			if (!isP) {
				d = A[2] - A[1];
				ret = A[0] + d;
				if (A[1] - ret != d) {
					op.println(0);
					return;
				}
				for (int i = 3; i < N; i++) {
					if (A[i] - A[i - 1] != d) {
						op.println(0);
						return;
					}
				}
			}
			op.println(1);
			op.println(ret);
			return;
		}
		if (d == 0) {
			op.println(1);
			op.println(A[0]);
			return;
		}
		if (N == 2 && d % 2 == 0) {
			int d1 = d / 2;
			op.println(3);
			op.println((A[0] - d) + " " + (A[0] + d1) + " " + (A[1] + d));
			return;
		}
		op.println(2);
		op.println((A[0] - d) + " " + (A[N - 1] + d));
	}
}


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

public class CFR2243 {
	public static void main (String[] args) {
		Scanner sc = new Scanner (System.in);
		PrintStream op = System.out;
		int N = sc.nextInt();
		int[] A = new int [N];
		for (int i = 0; i < N; i++)
			A[i] = sc.nextInt();
		if (N == 1) {
			op.println(-1);
			return;
		}
		Arrays.sort(A);
		int d = A[1] - A[0];
		boolean used = false;
		int ret = -1;
		for (int i = 2; i < N; i++) {
			if (A[i] - A[i - 1] != d) {
				if (used) {
					op.println(0);
					return;
				}
				else {
					used = true;
					ret = A[i - 1] + d;
					if (A[i] - ret != d) {
						op.println(0);
						return;
					}
				}
			}
		}
		if (used) {
			op.println(1);
			op.println(ret);
			return;
		}
		if (N == 2 && d > 1 && d % 2 == 0) {
			int d1 = d / 2;
			op.println(3);
			op.println("" + (A[0] - d) + " " + (A[0] + d1) + " " + (A[1] + d));
			return;
		}
		op.println(2);
		op.println("" + (A[0] - d) + " " + (A[N - 1] + d));
		sc.close();
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Task {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA s = new TaskA();
		s.solve(in, out);
		out.close();
	}
}

class TaskA {
	public void solve(InputReader in, PrintWriter out) {
		int n=in.nextInt();
		long[] a=new long[n];
		for(int i=0;i<n;i++){
			a[i]=in.nextLong();
		}
		Arrays.sort(a);

		if(n==1){
			out.println("-1");
			return;
		}else if(n==2){
			if(a[1]-a[0]%2==1){
				out.println(2);
				out.println((a[0]*2-a[1])+" "+(a[1]*2-a[0]));
			}else{
				long step=(a[1]-a[0])/2;
				if(step!=0){
					out.println(3);
					out.println((a[0]*2-a[1])+" "+(a[0]+step)+" "+(a[1]*2-a[0]));
				}else{
					out.println(1);
					out.println(a[0]);
				}

			}

			return;
		}

		long first,second,fcnt,scnt;
		first=second=-1;
		fcnt=scnt=0;
		for(int i=1;i<n;i++){
			long tmp=a[i]-a[i-1];
			if(first==-1){
				first=tmp;
				fcnt++;
			}else{
				if(tmp==first){
					fcnt++;
				}else{
					if(second==-1){
						second=tmp;
						scnt++;
					}else{
						if(tmp==second){
							scnt++;
						}else{
							out.println(0);
							return;
						}
					}
				}
			}
		}

		long[] ans=null;
		long index,step;
		index=step=-1;
		if(fcnt==n-1){
			if(step!=0){
				out.println(2);
				out.println((a[0]-first)+" "+(a[n-1]+first));
				return;
			}else{
				out.println(1);
				out.println(a[0]);
			}

		}else if(fcnt==n-2){
			if(first*2==second){
				step=first;
			}else if(second*2==first){
				step=second;
			}else{
			}

		}else if(fcnt==1){
			if(first*2==second){
				step=first;
			}else if(second*2==first){
				step=second;
			}else{
			}
		}else{
			out.println(0);
			return;
		}

		if(ans==null && step==-1){
			out.println(0);
			return;
		}

		for(int i=1;i<n;i++){
			if(a[i]-a[i-1]!=step){
				index=i;
			}
		}
		ans=new long[1];
		ans[0]=a[(int)index]-step;

		out.println(ans.length);
		for(int i=0;i<ans.length;i++){
			if(i==0)
				out.print(ans[i]);
			else
				out.print(" "+ans[i]);
		}
		out.println();
	}

}

class Result{
	public int b;
	public int step;
	public int total;
	public Result(int b, int step, int total) {
		super();
		this.b = b;
		this.step = step;
		this.total = total;
	}

}

class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong(){
		return Long.parseLong(next());
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Task {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA s = new TaskA();
		s.solve(in, out);
		out.close();
	}
}

class TaskA {
	public void solve(InputReader in, PrintWriter out) {
		int n=in.nextInt();
		int[] a=new int[n];
		for(int i=0;i<n;i++){
			a[i]=in.nextInt();
		}
		Arrays.sort(a);

		if(n==1){
			out.println("-1");
			return;
		}else if(n==2){
			if(a[1]-a[0]%2==1){
				out.println(2);
				out.println((a[0]*2-a[1])+" "+(a[1]*2-a[0]));
			}else{
				int step=(a[1]-a[0])/2;
				out.println(3);
				out.println((a[0]*2-a[1])+" "+(a[0]+step)+" "+(a[1]*2-a[0]));
			}

			return;
		}

		int first,second,fcnt,scnt;
		first=second=-1;
		fcnt=scnt=0;
		for(int i=1;i<n;i++){
			int tmp=a[i]-a[i-1];
			if(first==-1){
				first=tmp;
				fcnt++;
			}else{
				if(tmp==first){
					fcnt++;
				}else{
					if(second==-1){
						second=tmp;
						scnt++;
					}else{
						if(tmp==second){
							second++;
						}else{
							out.println(0);
							return;
						}
					}
				}
			}
		}

		int[] ans=null;
		int index,step;
		index=step=-1;
		if(fcnt==n-1){
			out.println(2);
			out.println((a[0]-first)+" "+(a[n-1]+first));
			return;
		}else if(fcnt==n-2){
			if(first*2==second){
				step=first;
			}else if(second*2==first){
				step=second;
			}else{
				out.println(0);
				return;
			}

		}else if(fcnt==1){
			if(first*2==second){
				step=first;
			}else if(second*2==first){
				step=second;
			}else{
				out.println(0);
				return;
			}
		}else{
			out.println(0);
			return;
		}

		if(ans==null && step==-1){
			out.println(0);
			return;
		}

		for(int i=1;i<n;i++){
			if(a[i]-a[i-1]!=step){
				index=i;
			}
		}
		ans=new int[1];
		ans[0]=a[index]-step;

		out.println(ans.length);
		for(int i=0;i<ans.length;i++){
			if(i==0)
				out.print(ans[i]);
			else
				out.print(" "+ans[i]);
		}
		out.println();
	}

}

class Result{
	public int b;
	public int step;
	public int total;
	public Result(int b, int step, int total) {
		super();
		this.b = b;
		this.step = step;
		this.total = total;
	}

}

class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong(){
		return Long.parseLong(next());
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Task {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA s = new TaskA();
		s.solve(in, out);
		out.close();
	}
}

class TaskA {
	public void solve(InputReader in, PrintWriter out) {
		int n=in.nextInt();
		long[] a=new long[n];
		for(int i=0;i<n;i++){
			a[i]=in.nextLong();
		}
		Arrays.sort(a);

		if(n==1){
			out.println("-1");
			return;
		}else if(n==2){
			if((a[1]-a[0])%2==1){
				out.println(2);
				out.println((a[0]*2-a[1])+" "+(a[1]*2-a[0]));
			}else{
				long step=(a[1]-a[0])/2;
				if(step!=0){
					out.println(3);
					out.println((a[0]*2-a[1])+" "+(a[0]+step)+" "+(a[1]*2-a[0]));
				}else{
					out.println(1);
					out.println(a[0]);
				}

			}

			return;
		}

		long first,second,fcnt,scnt;
		first=second=-1;
		fcnt=scnt=0;
		for(int i=1;i<n;i++){
			long tmp=a[i]-a[i-1];
			if(first==-1){
				first=tmp;
				fcnt++;
			}else{
				if(tmp==first){
					fcnt++;
				}else{
					if(second==-1){
						second=tmp;
						scnt++;
					}else{
						if(tmp==second){
							scnt++;
						}else{
							out.println(0);
							return;
						}
					}
				}
			}
		}

		long[] ans=null;
		long index,step;
		index=step=-1;
		if(fcnt==n-1){
			step=first;
			if(step!=0){
				out.println(2);
				out.println((a[0]-first)+" "+(a[n-1]+first));
				return;
			}else{
				out.println(1);
				out.println(a[0]);
				return;
			}

		}else if(fcnt==n-2 || fcnt==1){
			if(fcnt>=scnt && first*2==second){
				step=first;
			}else if(fcnt<=scnt && second*2==first){
				step=second;
			}else{
				out.println(0);
				return;
			}

		}else{
			out.println(0);
			return;
		}

		if(ans==null && step==-1){
			out.println(0);
			return;
		}

		for(int i=1;i<n;i++){
			if(a[i]-a[i-1]!=step){
				index=i;
			}
		}
		ans=new long[1];
		ans[0]=a[(int)index]-step;

		out.println(ans.length);
		for(int i=0;i<ans.length;i++){
			if(i==0)
				out.print(ans[i]);
			else
				out.print(" "+ans[i]);
		}
		out.println();
	}

}

class Result{
	public int b;
	public int step;
	public int total;
	public Result(int b, int step, int total) {
		super();
		this.b = b;
		this.step = step;
		this.total = total;
	}

}

class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong(){
		return Long.parseLong(next());
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Task {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA s = new TaskA();
		s.solve(in, out);
		out.close();
	}
}

class TaskA {
	public void solve(InputReader in, PrintWriter out) {
		int n=in.nextInt();
		long[] a=new long[n];
		for(int i=0;i<n;i++){
			a[i]=in.nextLong();
		}
		Arrays.sort(a);

		if(n==1){
			out.println("-1");
			return;
		}else if(n==2){
			if((a[1]-a[0])%2==1){
				out.println(2);
				out.println((a[0]*2-a[1])+" "+(a[1]*2-a[0]));
			}else{
				long step=(a[1]-a[0])/2;
				if(step!=0){
					out.println(3);
					out.println((a[0]*2-a[1])+" "+(a[0]+step)+" "+(a[1]*2-a[0]));
				}else{
					out.println(1);
					out.println(a[0]);
				}

			}

			return;
		}

		long first,second,fcnt,scnt;
		first=second=-1;
		fcnt=scnt=0;
		for(int i=1;i<n;i++){
			long tmp=a[i]-a[i-1];
			if(first==-1){
				first=tmp;
				fcnt++;
			}else{
				if(tmp==first){
					fcnt++;
				}else{
					if(second==-1){
						second=tmp;
						scnt++;
					}else{
						if(tmp==second){
							scnt++;
						}else{
							out.println(0);
							return;
						}
					}
				}
			}
		}

		long[] ans=null;
		long index,step;
		index=step=-1;
		if(fcnt==n-1){
			if(step!=0){
				out.println(2);
				out.println((a[0]-first)+" "+(a[n-1]+first));
				return;
			}else{
				out.println(1);
				out.println(a[0]);
			}

		}else if(fcnt==n-2){
			if(first*2==second){
				step=first;
			}else if(second*2==first){
				step=second;
			}else{
			}

		}else if(fcnt==1){
			if(first*2==second){
				step=first;
			}else if(second*2==first){
				step=second;
			}else{
			}
		}else{
			out.println(0);
			return;
		}

		if(ans==null && step==-1){
			out.println(0);
			return;
		}

		for(int i=1;i<n;i++){
			if(a[i]-a[i-1]!=step){
				index=i;
			}
		}
		ans=new long[1];
		ans[0]=a[(int)index]-step;

		out.println(ans.length);
		for(int i=0;i<ans.length;i++){
			if(i==0)
				out.print(ans[i]);
			else
				out.print(" "+ans[i]);
		}
		out.println();
	}

}

class Result{
	public int b;
	public int step;
	public int total;
	public Result(int b, int step, int total) {
		super();
		this.b = b;
		this.step = step;
		this.total = total;
	}

}

class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong(){
		return Long.parseLong(next());
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Task {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA s = new TaskA();
		s.solve(in, out);
		out.close();
	}
}

class TaskA {
	public void solve(InputReader in, PrintWriter out) {
		int n=in.nextInt();
		long[] a=new long[n];
		for(int i=0;i<n;i++){
			a[i]=in.nextLong();
		}
		Arrays.sort(a);

		if(n==1){
			out.println("-1");
			return;
		}else if(n==2){
			if(a[1]-a[0]%2==1){
				out.println(2);
				out.println((a[0]*2-a[1])+" "+(a[1]*2-a[0]));
			}else{
				long step=(a[1]-a[0])/2;
				out.println(3);
				out.println((a[0]*2-a[1])+" "+(a[0]+step)+" "+(a[1]*2-a[0]));
			}

			return;
		}

		long first,second,fcnt,scnt;
		first=second=-1;
		fcnt=scnt=0;
		for(int i=1;i<n;i++){
			long tmp=a[i]-a[i-1];
			if(first==-1){
				first=tmp;
				fcnt++;
			}else{
				if(tmp==first){
					fcnt++;
				}else{
					if(second==-1){
						second=tmp;
						scnt++;
					}else{
						if(tmp==second){
							scnt++;
						}else{
							out.println(0);
							return;
						}
					}
				}
			}
		}

		long[] ans=null;
		long index,step;
		index=step=-1;
		if(fcnt==n-2){
			out.println(2);
			out.println((a[0]-first)+" "+(a[n-1]+first));
			return;
		}else if(fcnt==n-3){
			if(first*2==second){
				step=first;
			}else if(second*2==first){
				step=second;
			}else{
				out.println(0);
				return;
			}

		}else if(fcnt==1){
			if(first*2==second){
				step=first;
			}else if(second*2==first){
				step=second;
			}else{
				out.println(0);
				return;
			}
		}else{
			out.println(0);
			return;
		}

		if(ans==null && step==-1){
			out.println(0);
			return;
		}

		for(int i=1;i<n;i++){
			if(a[i]-a[i-1]!=step){
				index=i;
			}
		}
		ans=new long[1];
		ans[0]=a[(int)index]-step;

		out.println(ans.length);
		for(int i=0;i<ans.length;i++){
			if(i==0)
				out.print(ans[i]);
			else
				out.print(" "+ans[i]);
		}
		out.println();
	}

}

class Result{
	public int b;
	public int step;
	public int total;
	public Result(int b, int step, int total) {
		super();
		this.b = b;
		this.step = step;
		this.total = total;
	}

}

class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong(){
		return Long.parseLong(next());
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Task {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA s = new TaskA();
		s.solve(in, out);
		out.close();
	}
}

class TaskA {
	public void solve(InputReader in, PrintWriter out) {
		int n=in.nextInt();
		long[] a=new long[n];
		for(int i=0;i<n;i++){
			a[i]=in.nextLong();
		}
		Arrays.sort(a);

		if(n==1){
			out.println("-1");
			return;
		}else if(n==2){
			if((a[1]-a[0])%2==1){
				out.println(2);
				out.println((a[0]*2-a[1])+" "+(a[1]*2-a[0]));
			}else{
				long step=(a[1]-a[0])/2;
				if(step!=0){
					out.println(3);
					out.println((a[0]*2-a[1])+" "+(a[0]+step)+" "+(a[1]*2-a[0]));
				}else{
					out.println(1);
					out.println(a[0]);
				}

			}

			return;
		}

		long first,second,fcnt,scnt;
		first=second=-1;
		fcnt=scnt=0;
		for(int i=1;i<n;i++){
			long tmp=a[i]-a[i-1];
			if(first==-1){
				first=tmp;
				fcnt++;
			}else{
				if(tmp==first){
					fcnt++;
				}else{
					if(second==-1){
						second=tmp;
						scnt++;
					}else{
						if(tmp==second){
							scnt++;
						}else{
							out.println(0);
							return;
						}
					}
				}
			}
		}

		long[] ans=null;
		long index,step;
		index=step=-1;
		if(fcnt==n-1){
			step=first;
			if(step!=0){
				out.println(2);
				out.println((a[0]-first)+" "+(a[n-1]+first));
				return;
			}else{
				out.println(1);
				out.println(a[0]);
			}

		}else if(fcnt==n-2){
			if(first*2==second){
				step=first;
			}else if(second*2==first){
				step=second;
			}else{
			}

		}else if(fcnt==1){
			if(first*2==second){
				step=first;
			}else if(second*2==first){
				step=second;
			}else{
			}
		}else{
			out.println(0);
			return;
		}

		if(ans==null && step==-1){
			out.println(0);
			return;
		}

		for(int i=1;i<n;i++){
			if(a[i]-a[i-1]!=step){
				index=i;
			}
		}
		ans=new long[1];
		ans[0]=a[(int)index]-step;

		out.println(ans.length);
		for(int i=0;i<ans.length;i++){
			if(i==0)
				out.print(ans[i]);
			else
				out.print(" "+ans[i]);
		}
		out.println();
	}

}

class Result{
	public int b;
	public int step;
	public int total;
	public Result(int b, int step, int total) {
		super();
		this.b = b;
		this.step = step;
		this.total = total;
	}

}

class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong(){
		return Long.parseLong(next());
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Task {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA s = new TaskA();
		s.solve(in, out);
		out.close();
	}
}

class TaskA {
	public void solve(InputReader in, PrintWriter out) {
		int n=in.nextInt();
		long[] a=new long[n];
		for(int i=0;i<n;i++){
			a[i]=in.nextLong();
		}
		Arrays.sort(a);

		if(n==1){
			out.println("-1");
			return;
		}else if(n==2){
			if(a[1]-a[0]%2==1){
				out.println(2);
				out.println((a[0]*2-a[1])+" "+(a[1]*2-a[0]));
			}else{
				long step=(a[1]-a[0])/2;
				out.println(3);
				out.println((a[0]*2-a[1])+" "+(a[0]+step)+" "+(a[1]*2-a[0]));
			}

			return;
		}

		long first,second,fcnt,scnt;
		first=second=-1;
		fcnt=scnt=0;
		for(int i=1;i<n;i++){
			long tmp=a[i]-a[i-1];
			if(first==-1){
				first=tmp;
				fcnt++;
			}else{
				if(tmp==first){
					fcnt++;
				}else{
					if(second==-1){
						second=tmp;
						scnt++;
					}else{
						if(tmp==second){
							second++;
						}else{
							out.println(0);
							return;
						}
					}
				}
			}
		}

		long[] ans=null;
		long index,step;
		index=step=-1;
		if(fcnt==n-1){
			out.println(2);
			out.println((a[0]-first)+" "+(a[n-1]+first));
			return;
		}else if(fcnt==n-2){
			if(first*2==second){
				step=first;
			}else if(second*2==first){
				step=second;
			}else{
				out.println(0);
				return;
			}

		}else if(fcnt==1){
			if(first*2==second){
				step=first;
			}else if(second*2==first){
				step=second;
			}else{
				out.println(0);
				return;
			}
		}else{
			out.println(0);
			return;
		}

		if(ans==null && step==-1){
			out.println(0);
			return;
		}

		for(int i=1;i<n;i++){
			if(a[i]-a[i-1]!=step){
				index=i;
			}
		}
		ans=new long[1];
		ans[0]=a[(int)index]-step;

		out.println(ans.length);
		for(int i=0;i<ans.length;i++){
			if(i==0)
				out.print(ans[i]);
			else
				out.print(" "+ans[i]);
		}
		out.println();
	}

}

class Result{
	public int b;
	public int step;
	public int total;
	public Result(int b, int step, int total) {
		super();
		this.b = b;
		this.step = step;
		this.total = total;
	}

}

class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong(){
		return Long.parseLong(next());
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Task {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA s = new TaskA();
		s.solve(in, out);
		out.close();
	}
}

class TaskA {
	public void solve(InputReader in, PrintWriter out) {
		int n=in.nextInt();
		long[] a=new long[n];
		for(int i=0;i<n;i++){
			a[i]=in.nextLong();
		}
		Arrays.sort(a);

		if(n==1){
			out.println("-1");
			return;
		}else if(n==2){
			if(a[1]-a[0]%2==1){
				out.println(2);
				out.println((a[0]*2-a[1])+" "+(a[1]*2-a[0]));
			}else{
				long step=(a[1]-a[0])/2;
				out.println(3);
				out.println((a[0]*2-a[1])+" "+(a[0]+step)+" "+(a[1]*2-a[0]));
			}

			return;
		}

		long first,second,fcnt,scnt;
		first=second=-1;
		fcnt=scnt=0;
		for(int i=1;i<n;i++){
			long tmp=a[i]-a[i-1];
			if(first==-1){
				first=tmp;
				fcnt++;
			}else{
				if(tmp==first){
					fcnt++;
				}else{
					if(second==-1){
						second=tmp;
						scnt++;
					}else{
						if(tmp==second){
							scnt++;
						}else{
							out.println(0);
							return;
						}
					}
				}
			}
		}

		long[] ans=null;
		long index,step;
		index=step=-1;
		if(fcnt==n-1){
			out.println(2);
			out.println((a[0]-first)+" "+(a[n-1]+first));
			return;
		}else if(fcnt==n-2){
			if(first*2==second){
				step=first;
			}else if(second*2==first){
				step=second;
			}else{
				out.println(0);
				return;
			}

		}else if(fcnt==1){
			if(first*2==second){
				step=first;
			}else if(second*2==first){
				step=second;
			}else{
				out.println(0);
				return;
			}
		}else{
			out.println(0);
			return;
		}

		if(ans==null && step==-1){
			out.println(0);
			return;
		}

		for(int i=1;i<n;i++){
			if(a[i]-a[i-1]!=step){
				index=i;
			}
		}
		ans=new long[1];
		ans[0]=a[(int)index]-step;

		out.println(ans.length);
		for(int i=0;i<ans.length;i++){
			if(i==0)
				out.print(ans[i]);
			else
				out.print(" "+ans[i]);
		}
		out.println();
	}

}

class Result{
	public int b;
	public int step;
	public int total;
	public Result(int b, int step, int total) {
		super();
		this.b = b;
		this.step = step;
		this.total = total;
	}

}

class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong(){
		return Long.parseLong(next());
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Task {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA s = new TaskA();
		s.solve(in, out);
		out.close();
	}
}

class TaskA {
	public void solve(InputReader in, PrintWriter out) {
		int n=in.nextInt();
		long[] a=new long[n];
		for(int i=0;i<n;i++){
			a[i]=in.nextLong();
		}
		Arrays.sort(a);

		if(n==1){
			out.println("-1");
			return;
		}else if(n==2){
			if((a[1]-a[0])%2==1){
				out.println(2);
				out.println((a[0]*2-a[1])+" "+(a[1]*2-a[0]));
			}else{
				long step=(a[1]-a[0])/2;
				if(step!=0){
					out.println(3);
					out.println((a[0]*2-a[1])+" "+(a[0]+step)+" "+(a[1]*2-a[0]));
				}else{
					out.println(1);
					out.println(a[0]);
				}

			}

			return;
		}

		long first,second,fcnt,scnt;
		first=second=-1;
		fcnt=scnt=0;
		for(int i=1;i<n;i++){
			long tmp=a[i]-a[i-1];
			if(first==-1){
				first=tmp;
				fcnt++;
			}else{
				if(tmp==first){
					fcnt++;
				}else{
					if(second==-1){
						second=tmp;
						scnt++;
					}else{
						if(tmp==second){
							scnt++;
						}else{
							out.println(0);
							return;
						}
					}
				}
			}
		}

		long[] ans=null;
		long index,step;
		index=step=-1;
		if(fcnt==n-1){
			step=first;
			if(step!=0){
				out.println(2);
				out.println((a[0]-first)+" "+(a[n-1]+first));
				return;
			}else{
				out.println(1);
				out.println(a[0]);
				return;
			}

		}else if(fcnt==n-2 || fcnt==1){
			if(fcnt>=scnt && first*2==second){
				step=first;
			}else if(fcnt<scnt && second*2==first){
				step=second;
			}else{
				out.println(0);
				return;
			}

		}else{
			out.println(0);
			return;
		}

		if(ans==null && step==-1){
			out.println(0);
			return;
		}

		for(int i=1;i<n;i++){
			if(a[i]-a[i-1]!=step){
				index=i;
			}
		}
		ans=new long[1];
		ans[0]=a[(int)index]-step;

		out.println(ans.length);
		for(int i=0;i<ans.length;i++){
			if(i==0)
				out.print(ans[i]);
			else
				out.print(" "+ans[i]);
		}
		out.println();
	}

}

class Result{
	public int b;
	public int step;
	public int total;
	public Result(int b, int step, int total) {
		super();
		this.b = b;
		this.step = step;
		this.total = total;
	}

}

class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong(){
		return Long.parseLong(next());
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Task {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA s = new TaskA();
		s.solve(in, out);
		out.close();
	}
}

class TaskA {
	public void solve(InputReader in, PrintWriter out) {
		int n=in.nextInt();
		long[] a=new long[n];
		for(int i=0;i<n;i++){
			a[i]=in.nextLong();
		}
		Arrays.sort(a);

		if(n==1){
			out.println("-1");
			return;
		}else if(n==2){
			if(a[1]-a[0]%2==1){
				out.println(2);
				out.println((a[0]*2-a[1])+" "+(a[1]*2-a[0]));
			}else{
				long step=(a[1]-a[0])/2;
				out.println(3);
				out.println((a[0]*2-a[1])+" "+(a[0]+step)+" "+(a[1]*2-a[0]));
			}

			return;
		}

		long first,second,fcnt,scnt;
		first=second=-1;
		fcnt=scnt=0;
		for(int i=1;i<n;i++){
			long tmp=a[i]-a[i-1];
			if(first==-1){
				first=tmp;
				fcnt++;
			}else{
				if(tmp==first){
					fcnt++;
				}else{
					if(second==-1){
						second=tmp;
						scnt++;
					}else{
						if(tmp==second){
							scnt++;
						}else{
							out.println(0);
							return;
						}
					}
				}
			}
		}

		long[] ans=null;
		long index,step;
		index=step=-1;
		if(fcnt==n-1){
			out.println(2);
			out.println((a[0]-first)+" "+(a[n-1]+first));
			return;
		}else if(fcnt==n-2){
			if(first*2==second){
				step=first;
			}else if(second*2==first){
				step=second;
			}else{
			}

		}else if(fcnt==1){
			if(first*2==second){
				step=first;
			}else if(second*2==first){
				step=second;
			}else{
			}
		}else{
			out.println(0);
			return;
		}

		if(ans==null && step==-1){
			out.println(0);
			return;
		}

		for(int i=1;i<n;i++){
			if(a[i]-a[i-1]!=step){
				index=i;
			}
		}
		ans=new long[1];
		ans[0]=a[(int)index]-step;

		out.println(ans.length);
		for(int i=0;i<ans.length;i++){
			if(i==0)
				out.print(ans[i]);
			else
				out.print(" "+ans[i]);
		}
		out.println();
	}

}

class Result{
	public int b;
	public int step;
	public int total;
	public Result(int b, int step, int total) {
		super();
		this.b = b;
		this.step = step;
		this.total = total;
	}

}

class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong(){
		return Long.parseLong(next());
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Task {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA s = new TaskA();
		s.solve(in, out);
		out.close();
	}
}

class TaskA {
	public void solve(InputReader in, PrintWriter out) {
		int n=in.nextInt();
		long[] a=new long[n];
		for(int i=0;i<n;i++){
			a[i]=in.nextLong();
		}
		Arrays.sort(a);

		if(n==1){
			out.println("-1");
			return;
		}else if(n==2){
			if((a[1]-a[0])%2==1){
				out.println(2);
				out.println((a[0]*2-a[1])+" "+(a[1]*2-a[0]));
			}else{
				long step=(a[1]-a[0])/2;
				if(step!=0){
					out.println(3);
					out.println((a[0]*2-a[1])+" "+(a[0]+step)+" "+(a[1]*2-a[0]));
				}else{
					out.println(1);
					out.println(a[0]);
				}

			}

			return;
		}

		long first,second,fcnt,scnt;
		first=second=-1;
		fcnt=scnt=0;
		for(int i=1;i<n;i++){
			long tmp=a[i]-a[i-1];
			if(first==-1){
				first=tmp;
				fcnt++;
			}else{
				if(tmp==first){
					fcnt++;
				}else{
					if(second==-1){
						second=tmp;
						scnt++;
					}else{
						if(tmp==second){
							scnt++;
						}else{
							out.println(0);
							return;
						}
					}
				}
			}
		}

		long[] ans=null;
		long index,step;
		index=step=-1;
		if(fcnt==n-1){
			step=first;
			if(step!=0){
				out.println(2);
				out.println((a[0]-first)+" "+(a[n-1]+first));
				return;
			}else{
				out.println(1);
				out.println(a[0]);
				return;
			}

		}else if(fcnt==n-2){
			if(first*2==second){
				step=first;
			}else if(second*2==first){
				step=second;
			}else{
			}

		}else if(fcnt==1){
			if(first*2==second){
				step=first;
			}else if(second*2==first){
				step=second;
			}else{
			}
		}else{
			out.println(0);
			return;
		}

		if(ans==null && step==-1){
			out.println(0);
			return;
		}

		for(int i=1;i<n;i++){
			if(a[i]-a[i-1]!=step){
				index=i;
			}
		}
		ans=new long[1];
		ans[0]=a[(int)index]-step;

		out.println(ans.length);
		for(int i=0;i<ans.length;i++){
			if(i==0)
				out.print(ans[i]);
			else
				out.print(" "+ans[i]);
		}
		out.println();
	}

}

class Result{
	public int b;
	public int step;
	public int total;
	public Result(int b, int step, int total) {
		super();
		this.b = b;
		this.step = step;
		this.total = total;
	}

}

class InputReader {
	private BufferedReader reader;
	private StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong(){
		return Long.parseLong(next());
	}

}


import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;

/*
br = new BufferedReader(new FileReader("input.txt"));
pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
br = new BufferedReader(new InputStreamReader(System.in));
pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
 */

public class Main {
  private static BufferedReader br;
  private static StringTokenizer st;
  private static PrintWriter pw;

  public static void main(String[] args) throws IOException {
    br = new BufferedReader(new InputStreamReader(System.in));
    pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    //int qq = 1;
    int qq = Integer.MAX_VALUE;
    //int qq = readInt();
    for(int casenum = 1; casenum <= qq; casenum++)  {
      int n = readInt();
      int[] list = new int[n];
      for(int i = 0; i < n; i++) {
        list[i] = readInt();
      }
      for(int a = 0; a < 100; a++) {
        int x = (int)(Math.random()*n);
        int y = (int)(Math.random()*n);
        int temp = list[x];
        list[x] = list[y];
        list[y] = temp;
      }
      Arrays.sort(list);
      if(list.length == 1) {
        pw.println(-1);
      }
      else if(list[0] == list[n-1]) {
        pw.println(1);
        pw.println(list[0]);
      }
      else if(n == 2) {
        if(list[0] % 2 == list[1] % 2) {
          pw.println(3);
          pw.print(2 * list[0] - list[1]);
          pw.print(" ");
          pw.print((list[0] + list[1])/2);
          pw.print(" ");
          pw.print(2 * list[1] - list[0]);
          pw.println();
        }
        else {
          pw.println(2);
          pw.print(2 * list[0] - list[1]);
          pw.print(" ");
          pw.print(2 * list[1] - list[0]);
          pw.println();
        }
      }
      else {
        int ret = solve(list);
        if(ret == -1) {
          pw.println(2);
          pw.print(2*list[0] - list[1]);
          pw.print(" ");
          pw.print(list[n-1] + list[1] - list[0]);
          pw.println();
        }
        else if(ret == 0) {
          pw.println(0);
        }
        else {
          pw.println(1);
          pw.println(ret);
        }
      }
    }
    pw.close();
  }

  public static int solve(int[] list) {
    TreeMap<Integer, Integer> map = new TreeMap<Integer, Integer>();
    for(int i = 1; i < list.length; i++) {
      int key = list[i] - list[i-1];
      Integer value = map.get(key);
      if(value == null) value = 0;
      map.put(key, ++value);
    }
    if(map.size() > 2) return 0;
    if(map.size() == 1) return -1;
    int low = map.firstKey();
    int high = map.lastKey();
    if(map.get(high) != 1) return 0;
    if(2*low != high) return 0;
    for(int i = 1; i < list.length; i++) {
      if(list[i] - list[i-1] == high) {
        return ((list[i] + list[i-1]))/2;
      }
    }
    throw new RuntimeException();
  }

  private static void exitImmediately() {
    pw.close();
    System.exit(0);
  }

  private static long readLong() throws IOException {
    return Long.parseLong(nextToken());
  }

  private static double readDouble() throws IOException {
    return Double.parseDouble(nextToken());
  }

  private static int readInt() throws IOException {
    return Integer.parseInt(nextToken());
  }

  private static String nextToken() throws IOException  {
    while(st == null || !st.hasMoreTokens())  {
      if(!br.ready()) {
        exitImmediately();
      }
      st = new StringTokenizer(br.readLine().trim());
    }
    return st.nextToken();
  }
}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class ArithematicProgression {
    public static void main(String[] args) {
        InputReader r = new InputReader(System.in);
        int n = r.nextInt();
        if (n == 1) {
            System.out.println(-1);
            return;
        }
        Integer[] arr = new Integer[n];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = r.nextInt();
        }
        Arrays.sort(arr);
        int diff = arr[1] - arr[0];
        boolean can = true;
        for (int i = 0; i < arr.length - 1; i++)
            if (arr[i + 1] - arr[i] != diff)
                can = false;
        TreeSet<Integer> set = new TreeSet<Integer>();
        if (can) {
            set.add(arr[0] - diff);
            set.add(arr[n - 1] + diff);
        }
        int sum = arr[0] + arr[1];
        if (sum % 2 == 0) {
            int bisector = sum / 2;
            if (n == 2)
                set.add(bisector);
        }
        long total = 0;
        for (int i = 0; i < arr.length - 1; i++)
            total += arr[i + 1] - arr[i];
        if (total % n == 0) {
            long abs = total / n;
            int a1 = 0, a2 = 0, exp = -1;
            for (int i = 0; i < arr.length - 1; i++) {
                if (arr[i + 1] - arr[i] == abs)
                    a1++;
                else if (arr[i + 1] - arr[i] == 2 * abs) {
                    a2++;
                    exp = arr[i];
                }
            }
            if (a1 == n - 2 && a2 == 1)
                set.add((int) (exp + abs));
        }
        for (int i = 0; i < n / 2; i++) {
            int temp = arr[i];
            arr[i] = arr[n - 1 - i];
            arr[n - 1 - i] = temp;
        }
        if (can) {
            set.add(arr[0] + diff);
            set.add(arr[n - 1] - diff);
        }
        System.out.println(set.size());
        for (int x : set)
            System.out.println(x);
    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public InputReader(FileReader stream) {
            reader = new BufferedReader(stream);
            tokenizer = null;
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                return null;
            }
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}


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

public class Main {

	BufferedReader in;
	StringTokenizer str = null;
	PrintWriter out;

	private String next() throws Exception{
		if (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}

	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}

	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}

	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);

		int n = nextInt();
		if (n == 1) {
			out.println(-1);
			out.close();
			return;
		}

		int []a = new int[n];
		for(int i=0;i<n;i++) a[i] = nextInt();

		List<Integer> ret = new ArrayList<Integer>();

		Arrays.sort(a);
		if (check(a)){
			int d = a[1] - a[0];
			ret.add(a[0] - d);
			ret.add(a[n-1] + d);
			if (n == 2) {
				if ((a[0] + a[1]) % 2 == 0) {
					ret.add((a[0] + a[1])/2);
				}
			}

			out.println(ret.size());
			Collections.sort(ret);
			for(int i : ret)
				out.print(i + " ");
			out.println();
			out.close();
			return;
		}

		Set<Integer> set = new HashSet<Integer>();
		for(int i=1;i<n;i++)
			set.add(a[i] - a[i-1]);

		if (set.size() == 2) {
			int d = Math.min(a[1] - a[0], a[2] - a[1]);
			for(int i=1;i<n;i++){
				if (a[i] - a[i-1] != d) {
					int diff = a[i] - a[i-1];
					if (diff == 2*d) {
						out.println(1);
						out.println(a[i] - d);
						out.close();
						return;
					}else{
						out.println(0);
						out.close();
						return;
					}
				}
			}

		}else{
			out.println(0);
		}

		out.close();
	}

	private boolean check(int []a) {
		int d = a[1] - a[0];
		for(int i=2;i<a.length;i++)
			if (a[i] - a[i-1] != d)
				return false;
		return true;
	}

	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}


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

public class Main {

	BufferedReader in;
	StringTokenizer str = null;
	PrintWriter out;

	private String next() throws Exception{
		if (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}

	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}

	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}

	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);

		int n = nextInt();
		if (n == 1) {
			out.println(-1);
			out.close();
			return;
		}

		int []a = new int[n];
		for(int i=0;i<n;i++) a[i] = nextInt();

		Arrays.sort(a);
		if (check(a)){
			int d = a[1] - a[0];
			if (d == 0) {
				out.println(1);
				out.println(a[0]);
				out.close();
				return;
			}
			List<Integer> ret = new ArrayList<Integer>();
			ret.add(a[0] - d);
			ret.add(a[n-1] + d);
			if (n == 2) {
				if ((a[0] + a[1]) % 2 == 0) {
					ret.add((a[0] + a[1])/2);
				}
			}

			out.println(ret.size());
			Collections.sort(ret);
			for(int i : ret)
				out.print(i + " ");
			out.println();
			out.close();
			return;
		}

		Set<Integer> set = new HashSet<Integer>();
		for(int i=1;i<n;i++)
			set.add(a[i] - a[i-1]);

		if (set.size() == 2) {
			int d = Math.min(a[1] - a[0], a[2] - a[1]);
			for(int i=1;i<n;i++){
				if (a[i] - a[i-1] != d) {
					int diff = a[i] - a[i-1];
					if (diff == 2*d) {
						out.println(1);
						out.println(a[i] - d);
						out.close();
						return;
					}else{
						out.println(0);
						out.close();
						return;
					}
				}
			}

		}else{
			out.println(0);
		}

		out.close();
	}

	private boolean check(int []a) {
		int d = a[1] - a[0];
		for(int i=2;i<a.length;i++)
			if (a[i] - a[i-1] != d)
				return false;
		return true;
	}

	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}


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

public class Main {

	BufferedReader in;
	StringTokenizer str = null;
	PrintWriter out;

	private String next() throws Exception{
		if (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}

	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}

	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}

	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);

		int n = nextInt();
		if (n == 1) {
			out.println(-1);
			out.close();
			return;
		}

		int []a = new int[n];
		for(int i=0;i<n;i++) a[i] = nextInt();

		Arrays.sort(a);
		if (check(a)){
			int d = a[1] - a[0];
			if (d == 0) {
				out.println(1);
				out.println(a[0]);
				out.close();
				return;
			}
			List<Integer> ret = new ArrayList<Integer>();
			ret.add(a[0] - d);
			ret.add(a[n-1] + d);
			if (n == 2) {
				if ((a[0] + a[1]) % 2 == 0) {
					ret.add((a[0] + a[1])/2);
				}
			}

			out.println(ret.size());
			Collections.sort(ret);
			for(int i : ret)
				out.print(i + " ");
			out.println();
			out.close();
			return;
		}

		Set<Integer> set = new HashSet<Integer>();
		for(int i=1;i<n;i++)
			set.add(a[i] - a[i-1]);

		if (set.size() == 2) {
			int d = Math.min(a[1] - a[0], a[2] - a[1]);
			int c = 0;
			int insert = 0;
			for(int i=1;i<n;i++){
				if (a[i] - a[i-1] != d) {
					int diff = a[i] - a[i-1];
					if (diff == 2*d) {
						c++;
						insert = a[i] - d;
						if (c > 1) {
							out.println(0);
							out.close();
							return;
						}
					}
				}
			}
			out.println(1);
			out.println(insert);
		}else{
			out.println(0);
		}

		out.close();
	}

	private boolean check(int []a) {
		int d = a[1] - a[0];
		for(int i=2;i<a.length;i++)
			if (a[i] - a[i-1] != d)
				return false;
		return true;
	}

	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}


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

public class Main {

	BufferedReader in;
	StringTokenizer str = null;
	PrintWriter out;

	private String next() throws Exception{
		if (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}

	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}

	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}

	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);

		int n = nextInt();
		if (n == 1) {
			out.println(-1);
			out.close();
			return;
		}

		int []a = new int[n];
		for(int i=0;i<n;i++) a[i] = nextInt();

		Arrays.sort(a);
		if (check(a)){
			int d = a[1] - a[0];
			if (d == 0) {
				out.println(1);
				out.println(a[0]);
				out.close();
				return;
			}
			List<Integer> ret = new ArrayList<Integer>();
			ret.add(a[0] - d);
			ret.add(a[n-1] + d);
			if (n == 2) {
				if ((a[0] + a[1]) % 2 == 0) {
					ret.add((a[0] + a[1])/2);
				}
			}

			out.println(ret.size());
			Collections.sort(ret);
			for(int i : ret)
				out.print(i + " ");
			out.println();
			out.close();
			return;
		}

		Set<Integer> set = new HashSet<Integer>();
		for(int i=1;i<n;i++)
			set.add(a[i] - a[i-1]);

		if (set.size() == 2) {
			int d = Math.min(a[1] - a[0], a[2] - a[1]);
			int c = 0;
			int insert = 0;
			for(int i=1;i<n;i++){
				if (a[i] - a[i-1] != d) {
					int diff = a[i] - a[i-1];
					if (diff == 2*d) {
						c++;
						insert = a[i] - d;
						if (c > 1) {
							out.println(0);
							out.close();
							return;
						}
					}else{
						out.println(0);
						out.close();
						return;
					}
				}
			}
			out.println(1);
			out.println(insert);
		}else{
			out.println(0);
		}

		out.close();
	}

	private boolean check(int []a) {
		int d = a[1] - a[0];
		for(int i=2;i<a.length;i++)
			if (a[i] - a[i-1] != d)
				return false;
		return true;
	}

	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class C {
	BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter out;

	public void solve() throws IOException {
		int N = nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = nextInt();
		}
		Arrays.sort(A);

		if (N == 1) {
			out.println(-1);
			return;
		}
		if (N == 2) {
			if (A[0] == A[1]) {
				out.println(1);
				out.println(A[0]);
			} else {
				if ( (A[1] - A[0]) % 2 == 1) {
					out.println(2);
					out.println( (A[0] - (A[1]-A[0])) + " " + (A[1] + (A[1]-A[0])) );
				} else {
					out.println(3);
					int mid = A[0] + (A[1] - A[0])/2;
					out.println( (A[0] - (A[1]-A[0])) + " " + mid + " " + (A[1] + (A[1]-A[0])) );
				}
			}
			return;
		}

		int[] D = new int[N-1];
		for (int i = 1; i < N; i++) {
			D[i-1] = A[i] - A[i-1];
		}

		boolean aSame = true;
		boolean dSame = true;

		for (int i = 1; i < N; i++) {
			if (A[i] != A[i-1]) aSame = false;
		}
		for (int i = 1; i < N-1; i++) {
			if (D[i] != D[i-1]) dSame = false;
		}

		if (aSame) {
			out.println(1);
			out.println(A[0]);
			return;
		}
		else if (dSame) {
			out.println(2);
			out.println( (A[0] - D[0]) + " " + (A[N-1] + D[0]) );
			return;
		}

		HashMap<Integer, Integer> diffs = new HashMap<Integer, Integer>();
		for (int i = 0; i < N-1; i++) {
			if (diffs.containsKey(D[i])) {
				diffs.put(D[i], diffs.get(D[i])+1);
			} else {
				diffs.put(D[i], 1);
			}
		}

		if (diffs.size() > 2) {
			out.println(0);
			return;
		}

		int smallest = Integer.MAX_VALUE/2;
		int largest = -1;
		for (int d: diffs.keySet()) {
			smallest = Math.min(d, smallest);
			largest = Math.max(d, largest);
		}

		if (diffs.get(largest) > 1) {
			out.println(0);
			return;
		}

		if (largest/2 != smallest || largest % 2 == 1) {
			out.println(0);
			return;
		}

		out.println(1);
		for (int i = 0; i < N-1; i++) {
			if (D[i] == largest) {
				out.println( A[i] + largest/2);
			}
		}

	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new C().run();
	}

	public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            out = new PrintWriter(System.out);
            solve();
            reader.close();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class C {
	BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter out;

	public void solve() throws IOException {
		int N = nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = nextInt();
		}
		Arrays.sort(A);

		if (N == 1) {
			out.println(-1);
			return;
		}
		if (N == 2) {
			if (A[0] == A[1]) {
				out.println(1);
				out.println(A[0]);
			} else {
				if ( (A[1] - A[0]) % 2 == 1) {
					out.println(2);
					out.println( (A[0] - (A[1]-A[0])) + " " + (A[1] + (A[1]-A[0])) );
				} else {
					out.println(3);
					int mid = A[0] + (A[1] - A[0])/2;
					out.println( (A[0] - (A[1]-A[0])) + " " + mid + " " + (A[1] + (A[1]-A[0])) );
				}
			}
			return;
		}

		int[] D = new int[N-1];
		for (int i = 1; i < N; i++) {
			D[i-1] = A[i] - A[i-1];
		}

		boolean aSame = true;
		boolean dSame = true;

		for (int i = 1; i < N; i++) {
			if (A[i] != A[i-1]) aSame = false;
		}
		for (int i = 1; i < N-1; i++) {
			if (D[i] != D[i-1]) dSame = false;
		}

		if (aSame) {
			out.println(1);
			out.println(A[0]);
			return;
		}
		else if (dSame) {
			out.println(2);
			out.println( (A[0] - D[0]) + " " + (A[N-1] + D[0]) );
			return;
		}

		HashMap<Integer, Integer> diffs = new HashMap<Integer, Integer>();
		for (int i = 0; i < N-1; i++) {
			if (diffs.containsKey(D[i])) {
				diffs.put(D[i], diffs.get(D[i])+1);
			} else {
				diffs.put(D[i], 1);
			}
		}

		if (diffs.size() > 2) {
			out.println(0);
			return;
		}

		int smallest = Integer.MAX_VALUE/2;
		int largest = -1;
		for (int d: diffs.keySet()) {
			smallest = Math.min(d, smallest);
			largest = Math.max(d, largest);
		}

		if (diffs.get(largest) > 1) {
			out.println(0);
			return;
		}

		if (largest/2 != smallest) {
			out.println(0);
			return;
		}

		out.println(1);
		for (int i = 0; i < N-1; i++) {
			if (D[i] == largest) {
				out.println( A[i] + largest/2);
			}
		}

	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new C().run();
	}

	public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            out = new PrintWriter(System.out);
            solve();
            reader.close();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

}


import java.io.*;
import java.math.*;
import java.util.*;
import java.lang.*;

public class Main2{

    public static InputStream inputStream = System.in;
    public static OutputStream outputStream = System.out;
    public static FastReader in = new FastReader(inputStream);
    public static PrintWriter out = new PrintWriter(outputStream);

    public static void main(String[] args)throws java.lang.Exception{
        new Main2().run();
        out.close();
    }

    long[] arr;

    void run()throws java.lang.Exception{
        int n = in.nextInt();
        arr = new long[n];
        for(int i=0; i<n; i++){
            arr[i] = in.nextLong();
        }
        Arrays.sort(arr);
        if(n==1){
            System.out.println(-1);
        }else if(n==2){
            long before = arr[0]-(arr[1]-arr[0]);
            long after = arr[1]+(arr[1]-arr[0]);
            long mid = (arr[0]+arr[1])/2;
            if(mid-arr[0] != arr[1]-mid){
                System.out.println(2);
                System.out.println(before + " " + after);
            }else{
                System.out.println(3);
                System.out.println(before + " " + mid + " " + after);
            }
        }else{
            long d = arr[1]-arr[0];
            boolean ap = true;
            for(int i=2; i<arr.length; i++){
                long diff = arr[i]-arr[i-1];
                if(diff!=d){
                    ap = false;
                }
            }
            if(ap){
                System.out.println(2);
                System.out.println((arr[0]-d) + " " + (arr[n-1]+d));
            }else{
                HashMap<Long, Integer> map = new HashMap<Long, Integer>();
                for(int i=1; i<n; i++){
                    long dif = arr[i]-arr[i-1];
                    if(map.containsKey(dif)){
                        map.put(dif, -1);
                    }else{
                        map.put(dif, i);
                    }
                }
                if(map.entrySet().size() > 2){
                    System.out.println(0);
                }else{
                    long other = -1;
                    int i = -1;
                    for(Long dif : map.keySet()){
                        if(map.get(dif)==-1){
                            other = dif;
                            continue;
                        }
                        i = map.get(dif);
                    }
                    long mid = (arr[i]+arr[i-1])/2;
                    if(mid-arr[i-1] == arr[i]-mid && arr[i]-mid==other){
                        System.out.println(1);
                        System.out.println(mid);
                    }else{
                        System.out.println(0);
                    }
                }
            }
        }
    }
}

class FastReader{
    private boolean finished = false;

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

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

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

    public int peek(){
        if (numChars == -1){
            return -1;
        }
        if (curChar >= numChars){
            curChar = 0;
            try{
                numChars = stream.read (buf);
            } catch (IOException e){
                return -1;
            }
            if (numChars <= 0){
                return -1;
            }
        }
        return buf[curChar];
    }

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

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

    public String nextString(){
        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 boolean isSpaceChar(int c){
        if (filter != null){
            return filter.isSpaceChar (c);
        }
        return isWhitespace (c);
    }

    public static boolean isWhitespace(int c){
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private String readLine0(){
        StringBuilder buf = new StringBuilder ();
        int c = read ();
        while (c != '\n' && c != -1){
            if (c != '\r'){
                buf.appendCodePoint (c);
            }
            c = read ();
        }
        return buf.toString ();
    }

    public String nextLine(){
        String s = readLine0 ();
        while (s.trim ().length () == 0)
            s = readLine0 ();
        return s;
    }

    public String nextLine(boolean ignoreEmptyLines){
        if (ignoreEmptyLines){
            return nextLine ();
        }else{
            return readLine0 ();
        }
    }

    public BigInteger nextBigInteger(){
        try{
            return new BigInteger (nextString ());
        } catch (NumberFormatException e){
            throw new InputMismatchException ();
        }
    }

    public char nextCharacter(){
        int c = read ();
        while (isSpaceChar (c))
            c = read ();
        return (char) c;
    }

    public double nextDouble(){
        int c = read ();
        while (isSpaceChar (c))
            c = read ();
        int sgn = 1;
        if (c == '-'){
            sgn = -1;
            c = read ();
        }
        double res = 0;
        while (!isSpaceChar (c) && c != '.'){
            if (c == 'e' || c == 'E'){
                return res * Math.pow (10, nextInt ());
            }
            if (c < '0' || c > '9'){
                throw new InputMismatchException ();
            }
            res *= 10;
            res += c - '0';
            c = read ();
        }
        if (c == '.'){
            c = read ();
            double m = 1;
            while (!isSpaceChar (c)){
                if (c == 'e' || c == 'E'){
                    return res * Math.pow (10, nextInt ());
                }
                if (c < '0' || c > '9'){
                    throw new InputMismatchException ();
                }
                m /= 10;
                res += (c - '0') * m;
                c = read ();
            }
        }
        return res * sgn;
    }

    public boolean isExhausted(){
        int value;
        while (isSpaceChar (value = peek ()) && value != -1)
            read ();
        return value == -1;
    }

    public String next(){
        return nextString ();
    }

    public SpaceCharFilter getFilter(){
        return filter;
    }

    public void setFilter(SpaceCharFilter filter){
        this.filter = filter;
    }

    public interface SpaceCharFilter{
        public boolean isSpaceChar(int ch);
    }
}