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.HashMap;
import java.util.StringTokenizer;

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

	private static class Solution {
		private void solve(InputReader in, PrintWriter out) {
			int n = in.nextInt();
			int[] a = in.readArray(n);
			HashMap<Integer, ArrayList<Integer>> progressions = new HashMap<>();
			for (int i = 0; i < n; ++i) {
				ArrayList<Integer> l = progressions.getOrDefault(a[i], new ArrayList<>());
				l.add(i);
				progressions.put(a[i], l);
			}
			ArrayList<Pair> ans = new ArrayList<>();
			for (int key : progressions.keySet()) {
				ArrayList<Integer> aps = progressions.get(key);
				if (aps.size() == 1) {
					ans.add(new Pair(key, 0));
				} else {
					int diff = aps.get(1) - aps.get(0);
					boolean fail = true;
					for (int i = 1; i < aps.size(); ++i)
						if (aps.get(i) - aps.get(i - 1) != diff) {
							fail = false;
							break;
						}
					if (fail)
						ans.add(new Pair(key, diff));
				}
			}
			out.println(ans.size());
			for (int i = 0; i < ans.size(); ++i) {
				out.println(ans.get(i));
			}
		}
	}

	private static class Pair {
		int first, second;

		public Pair(int first, int second) {
			this.first = first;
			this.second = second;
		}

		@Override
		public String toString() {
			return first + " " + second;
		}
	}

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

		private InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

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

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

		private int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; ++i)
				a[i] = nextInt();
			return a;
		}
	}
}


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.HashMap;
import java.util.StringTokenizer;

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

	private static class Solution {
		private void solve(InputReader in, PrintWriter out) {
			int n = in.nextInt();
			int[] a = in.readArray(n);
			HashMap<Integer, Pair> progressions = new HashMap<>();
			for (int i = 0; i < n; ++i) {
				Pair val = progressions.getOrDefault(a[i], new Pair(i, 0));
				int temp = val.b;
				val.b = i - val.a;
//				out.println(temp + " " + val.b);
				if (temp != 0 && temp != val.b) {
					out.println(0);
					return;
				}
				val.a = i;
				progressions.put(a[i], val);
			}
//			out.println(progressions);
			out.println(progressions.size());
			for (int key : progressions.keySet()) {
				out.println(key + " " + progressions.get(key).b);
			}
		}
	}

	private static class Pair {
		Integer a, b;

		public Pair(int a, Integer b) {
			this.a = a;
			this.b = b;
		}

		@Override
		public String toString() {
			return "index: " + a + " diff: " + b;
		}
	}

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

		private InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

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

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

		private int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; ++i)
				a[i] = nextInt();
			return a;
		}
	}
}


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.HashMap;
import java.util.StringTokenizer;

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

	private static class Solution {
		private void solve(InputReader in, PrintWriter out) {
			int n = in.nextInt();
			int[] a = in.readArray(n);
			HashMap<Integer, Pair> progressions = new HashMap<>();
			for (int i = 0; i < n; ++i) {
				Pair val = progressions.getOrDefault(a[i], new Pair(i, 0));
				val.b = i - val.a;
				val.a = i;
				progressions.put(a[i], val);
			}
//			out.println(progressions);
			out.println(progressions.size());
			for (int key : progressions.keySet()) {
				out.println(key + " " + progressions.get(key).b);
			}
		}
	}

	private static class Pair {
		Integer a, b;

		public Pair(int a, Integer b) {
			this.a = a;
			this.b = b;
		}

		@Override
		public String toString() {
			return "index: " + a + " diff: " + b;
		}
	}

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

		private InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

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

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

		private int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; ++i)
				a[i] = nextInt();
			return a;
		}
	}
}


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.Collections;
import java.util.HashMap;
import java.util.StringTokenizer;

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

	private static class Solution {
		private void solve(InputReader in, PrintWriter out) {
			int n = in.nextInt();
			int[] a = in.readArray(n);
			HashMap<Integer, ArrayList<Integer>> progressions = new HashMap<>();
			for (int i = 0; i < n; ++i) {
				ArrayList<Integer> l = progressions.getOrDefault(a[i], new ArrayList<>());
				l.add(i);
				progressions.put(a[i], l);
			}
			ArrayList<Pair> ans = new ArrayList<>();
			for (int key : progressions.keySet()) {
				ArrayList<Integer> aps = progressions.get(key);
				if (aps.size() == 1) {
					ans.add(new Pair(key, 0));
				} else {
					int diff = aps.get(1) - aps.get(0);
					boolean fail = true;
					for (int i = 1; i < aps.size(); ++i)
						if (aps.get(i) - aps.get(i - 1) != diff) {
							fail = false;
							break;
						}
					if (fail)
						ans.add(new Pair(key, diff));
				}
			}
			Collections.sort(ans);
			out.println(ans.size());
			for (int i = 0; i < ans.size(); ++i) {
				out.println(ans.get(i));
			}
		}
	}

	private static class Pair implements Comparable<Pair> {
		int first, second;

		public Pair(int first, int second) {
			this.first = first;
			this.second = second;
		}

		@Override
		public String toString() {
			return first + " " + second;
		}

		@Override
		public int compareTo(Pair o) {
			return Integer.compare(first, o.first);
		}
	}

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

		private InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

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

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

		private int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; ++i)
				a[i] = nextInt();
			return a;
		}
	}
}


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

public class Main {
    //Fast Reader
    private static class FastReader {
        BufferedReader br;
        StringTokenizer st;

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

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

        public void resetST() {
            st = null;
        }

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

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

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

        public float nextFloat() {
            return Float.parseFloat(next());
        }

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

        public int[] nextIntArray(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        public long[] nextLongArray(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }

        public double[] nextDoubleArray(int size) {
            double[] arr = new double[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextDouble();
            }
            return arr;
        }
    }

    public static void main(String[] args) {
        final FastReader sc = new FastReader();
        final PrintWriter pr = new PrintWriter(System.out);
        int n = sc.nextInt();
        int[] p = new int[100001];
        int[] d = new int[100001];

        for (int i = 1; i <= n; i++) {
            int a = sc.nextInt();
            if (p[a] == -1) continue;
            if (p[a] == 0) {
                p[a] = i;
                continue;
            }
            if (d[a] == 0) {
                d[a] = i - p[a];
                p[a] = i;
            } else {
                if (i - p[a] == d[a]) {
                    p[a] = i;
                } else {
                    p[a] = -1;
                }
            }
        }
        StringBuilder str = new StringBuilder();
        int size = 0;
        for (int i = 1; i < 100001; i++) {
            if (p[i] != 0 && p[i] != -1) {
                str.append(i + " " + d[i] + "\n");
                size++;
            }
        }
        pr.println(size);
        pr.println(str);
        pr.close();
        // write your code here
    }
}


import java.io.*;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.util.List;

public class JeffAndPeriods {
	static BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));

	public static int isProgression(List<Integer> indexList)
	{
		if (indexList.size() == 1) { return 0; }

		int commonDiff = indexList.get(1) - indexList.get(0);
		for (int i = 2; i < indexList.size(); i++)
		{
			int prevIndex = indexList.get(i - 1);
			int currIndex = indexList.get(i);
			if (currIndex - prevIndex != commonDiff)
			{
				return -1;
			}
		}
		return commonDiff;
	}

	public static void main (String [] args) throws IOException
	{
		int integerCount = Integer.parseInt(reader.readLine());
		int [] integers = Arrays.stream(reader.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();

		LinkedHashMap<Integer, ArrayList<Integer>> indexMap = new LinkedHashMap<Integer, ArrayList<Integer>> ();
		for (int i = 0; i < integerCount; i++)
		{
			int current = integers[i];
			if (indexMap.containsKey(current))
			{
				ArrayList<Integer> indexList = indexMap.get(current);
				indexList.add(i);
				indexMap.put(current, indexList);
			}
			else
			{
				ArrayList<Integer> initializer = new ArrayList<Integer> ();
				initializer.add(i);
				indexMap.put(current, initializer);
			}
		}

		ArrayList<Integer[]> solution = new ArrayList<Integer[]> ();
		for (Integer key : indexMap.keySet())
		{
			ArrayList<Integer> indexList = indexMap.get(key);
			int isProgression = isProgression(indexList);
			if (isProgression != -1)
			{
				solution.add(new Integer [] {key, isProgression});
			}
		}

		System.out.println(solution.size());
		for (Integer [] sol : solution)
		{
			System.out.println(sol[0] + " " + sol[1]);
		}
	}
}


import java.io.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
import java.lang.StringBuilder;

public class JeffAndPeriods {
	static BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));

	public static int isProgression(List<Integer> indexList)
	{
		if (indexList.size() == 1) { return 0; }

		int commonDiff = indexList.get(1) - indexList.get(0);
		for (int i = 2; i < indexList.size(); i++)
		{
			int prevIndex = indexList.get(i - 1);
			int currIndex = indexList.get(i);
			if (currIndex - prevIndex != commonDiff)
			{
				return -1;
			}
		}
		return commonDiff;
	}

	public static void main (String [] args) throws IOException
	{
		int integerCount = Integer.parseInt(reader.readLine());
		int [] integers = Arrays.stream(reader.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();

		HashMap<Integer, ArrayList<Integer>> indexMap = new HashMap<Integer, ArrayList<Integer>> ();
		for (int i = 0; i < integerCount; i++)
		{
			int current = integers[i];
			if (indexMap.containsKey(current))
			{
				ArrayList<Integer> indexList = indexMap.get(current);
				indexList.add(i);
				indexMap.put(current, indexList);
			}
			else
			{
				ArrayList<Integer> initializer = new ArrayList<Integer> ();
				initializer.add(i);
				indexMap.put(current, initializer);
			}
		}

		ArrayList<Integer[]> solution = new ArrayList<Integer[]> ();
		for (Integer key : indexMap.keySet())
		{
			ArrayList<Integer> indexList = indexMap.get(key);
			int isProgression = isProgression(indexList);
			if (isProgression != -1)
			{
				solution.add(new Integer [] {key, isProgression});
			}
		}

		PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));

		pw.println(solution.size());
		StringBuilder str = new StringBuilder();

		Collections.sort(solution, (s1,s2) ->  s1[0] - s2[0] );
		for (Integer [] sol : solution)
		{
			pw.println(sol[0] + " " + sol[1]);
		}
	}
}


import java.io.*;
import java.util.Arrays;
import java.util.TreeMap;
import java.util.ArrayList;
import java.util.List;

public class JeffAndPeriods {
	static BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));

	public static int isProgression(List<Integer> indexList)
	{
		if (indexList.size() == 1) { return 0; }

		int commonDiff = indexList.get(1) - indexList.get(0);
		for (int i = 2; i < indexList.size(); i++)
		{
			int prevIndex = indexList.get(i - 1);
			int currIndex = indexList.get(i);
			if (currIndex - prevIndex != commonDiff)
			{
				return -1;
			}
		}
		return commonDiff;
	}

	public static void main (String [] args) throws IOException
	{
		int integerCount = Integer.parseInt(reader.readLine());
		int [] integers = Arrays.stream(reader.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();

		TreeMap<Integer, ArrayList<Integer>> indexMap = new TreeMap<Integer, ArrayList<Integer>> ();
		for (int i = 0; i < integerCount; i++)
		{
			int current = integers[i];
			if (indexMap.containsKey(current))
			{
				ArrayList<Integer> indexList = indexMap.get(current);
				indexList.add(i);
				indexMap.put(current, indexList);
			}
			else
			{
				ArrayList<Integer> initializer = new ArrayList<Integer> ();
				initializer.add(i);
				indexMap.put(current, initializer);
			}
		}

		ArrayList<Integer[]> solution = new ArrayList<Integer[]> ();
		for (Integer key : indexMap.keySet())
		{
			ArrayList<Integer> indexList = indexMap.get(key);
			int isProgression = isProgression(indexList);
			if (isProgression != -1)
			{
				solution.add(new Integer [] {key, isProgression});
			}
		}

		System.out.println(solution.size());
		for (Integer [] sol : solution)
		{
			System.out.println(sol[0] + " " + sol[1]);
		}
	}
}


import java.io.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Collections;

public class JeffAndPeriods {
	static BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));

	public static int isProgression(List<Integer> indexList)
	{
		if (indexList.size() == 1) { return 0; }

		int commonDiff = indexList.get(1) - indexList.get(0);
		for (int i = 2; i < indexList.size(); i++)
		{
			int prevIndex = indexList.get(i - 1);
			int currIndex = indexList.get(i);
			if (currIndex - prevIndex != commonDiff)
			{
				return -1;
			}
		}
		return commonDiff;
	}

	public static void main (String [] args) throws IOException
	{
		int integerCount = Integer.parseInt(reader.readLine());
		int [] integers = Arrays.stream(reader.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();

		HashMap<Integer, ArrayList<Integer>> indexMap = new HashMap<Integer, ArrayList<Integer>> ();
		for (int i = 0; i < integerCount; i++)
		{
			int current = integers[i];
			if (indexMap.containsKey(current))
			{
				ArrayList<Integer> indexList = indexMap.get(current);
				indexList.add(i);
				indexMap.put(current, indexList);
			}
			else
			{
				ArrayList<Integer> initializer = new ArrayList<Integer> ();
				initializer.add(i);
				indexMap.put(current, initializer);
			}
		}

		ArrayList<Integer[]> solution = new ArrayList<Integer[]> ();
		for (Integer key : indexMap.keySet())
		{
			ArrayList<Integer> indexList = indexMap.get(key);
			int isProgression = isProgression(indexList);
			if (isProgression != -1)
			{
				solution.add(new Integer [] {key, isProgression});
			}
		}

		System.out.println(solution.size());
		Collections.sort(solution, (s1,s2) ->  s1[0] - s2[0] );
		for (Integer [] sol : solution)
		{
			System.out.println(sol[0] + " " + sol[1]);
		}
	}
}


import java.io.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
import java.lang.StringBuilder;

public class JeffAndPeriods {
	static BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));

	public static int isProgression(List<Integer> indexList)
	{
		if (indexList.size() == 1) { return 0; }

		int commonDiff = indexList.get(1) - indexList.get(0);
		for (int i = 2; i < indexList.size(); i++)
		{
			int prevIndex = indexList.get(i - 1);
			int currIndex = indexList.get(i);
			if (currIndex - prevIndex != commonDiff)
			{
				return -1;
			}
		}
		return commonDiff;
	}

	public static void main (String [] args) throws IOException
	{
		int integerCount = Integer.parseInt(reader.readLine());
		int [] integers = Arrays.stream(reader.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();

		HashMap<Integer, ArrayList<Integer>> indexMap = new HashMap<Integer, ArrayList<Integer>> ();
		for (int i = 0; i < integerCount; i++)
		{
			int current = integers[i];
			if (indexMap.containsKey(current))
			{
				ArrayList<Integer> indexList = indexMap.get(current);
				indexList.add(i);
				indexMap.put(current, indexList);
			}
			else
			{
				ArrayList<Integer> initializer = new ArrayList<Integer> ();
				initializer.add(i);
				indexMap.put(current, initializer);
			}
		}

		ArrayList<Integer[]> solution = new ArrayList<Integer[]> ();
		for (Integer key : indexMap.keySet())
		{
			ArrayList<Integer> indexList = indexMap.get(key);
			int isProgression = isProgression(indexList);
			if (isProgression != -1)
			{
				solution.add(new Integer [] {key, isProgression});
			}
		}

		PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out, 5*1024*1024), true);

		pw.println(solution.size());
		StringBuilder str = new StringBuilder();

		Collections.sort(solution, (s1,s2) ->  s1[0] - s2[0] );
		for (Integer [] sol : solution)
		{
			pw.println(sol[0] + " " + sol[1]);
		}

	}
}


import java.io.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.List;

public class JeffAndPeriods {
	static BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));

	public static int isProgression(List<Integer> indexList)
	{
		if (indexList.size() == 1) { return 0; }

		int commonDiff = indexList.get(1) - indexList.get(0);
		for (int i = 2; i < indexList.size(); i++)
		{
			int prevIndex = indexList.get(i - 1);
			int currIndex = indexList.get(i);
			if (currIndex - prevIndex != commonDiff)
			{
				return -1;
			}
		}
		return commonDiff;
	}

	public static void main (String [] args) throws IOException
	{
		int integerCount = Integer.parseInt(reader.readLine());
		int [] integers = Arrays.stream(reader.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();

		HashMap<Integer, ArrayList<Integer>> indexMap = new HashMap<Integer, ArrayList<Integer>> ();
		for (int i = 0; i < integerCount; i++)
		{
			int current = integers[i];
			if (indexMap.containsKey(current))
			{
				ArrayList<Integer> indexList = indexMap.get(current);
				indexList.add(i);
				indexMap.put(current, indexList);
			}
			else
			{
				ArrayList<Integer> initializer = new ArrayList<Integer> ();
				initializer.add(i);
				indexMap.put(current, initializer);
			}
		}

		HashMap<Integer, Integer> solution = new HashMap<Integer, Integer>();
		for (Integer key : indexMap.keySet())
		{
			ArrayList<Integer> indexList = indexMap.get(key);
			int isProgression = isProgression(indexList);
			if (isProgression != -1)
			{
				solution.put(key, isProgression);
			}
		}

		System.out.println(solution.size());
		for (Integer key : solution.keySet())
		{
			System.out.println(key + " " + solution.get(key));
		}
	}
}


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

public class JeffAndPeriods {
	static BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));

	static class Number
	{
		int value;
		int lastIndex;
		int commonDiff;
		boolean isAP;

		public Number(int value, int currentIndex)
		{
			this.value = value;
			this.lastIndex = currentIndex;
			this.commonDiff = 0;
			this.isAP = true;
		}

		public void updateLastIndex(int currentIndex)
		{
			if (this.commonDiff == 0)
			{
				this.commonDiff = currentIndex - this.lastIndex;
				this.lastIndex = currentIndex;
			}
			else if (this.commonDiff == currentIndex - this.lastIndex)
			{
				this.lastIndex = currentIndex;
			}
			else
			{
				this.isAP = false;
			}
		}

		public boolean isAP()
		{
			return this.isAP;
		}

		public int getCommonDiff()
		{
			return this.commonDiff;
		}
	}

	public static void main (String [] args) throws IOException
	{
		int integerCount = Integer.parseInt(reader.readLine());
		int [] integers = Arrays.stream(reader.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();

		TreeMap<Integer, Number> indexMap = new TreeMap<Integer, Number> ();
		for (int i = 0; i < integerCount; i++)
		{
			int current = integers[i];
			if (indexMap.containsKey(current))
			{
				Number num = indexMap.get(current);
				if (num.isAP())
				{
					num.updateLastIndex(i);
				}
			}
			else
			{
				Number num = new Number(current, i);
				indexMap.put(current, num);
			}
		}

		int solutionSize = 0;
		StringBuilder str = new StringBuilder();
		for (Integer key : indexMap.keySet())
		{
			if (indexMap.get(key).isAP())
			{
				str.append(key + " " + indexMap.get(key).getCommonDiff() + "\n");
				solutionSize++;
			}
		}

		PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out), true);
		pw.println(solutionSize);
		pw.println(str.toString());

	}
}


import java.io.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
import java.lang.StringBuilder;

public class JeffAndPeriods {
	static BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));

	public static int isProgression(List<Integer> indexList)
	{
		if (indexList.size() == 1) { return 0; }

		int commonDiff = indexList.get(1) - indexList.get(0);
		for (int i = 2; i < indexList.size(); i++)
		{
			int prevIndex = indexList.get(i - 1);
			int currIndex = indexList.get(i);
			if (currIndex - prevIndex != commonDiff)
			{
				return -1;
			}
		}
		return commonDiff;
	}

	public static void main (String [] args) throws IOException
	{
		int integerCount = Integer.parseInt(reader.readLine());
		int [] integers = Arrays.stream(reader.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();

		HashMap<Integer, ArrayList<Integer>> indexMap = new HashMap<Integer, ArrayList<Integer>> ();
		for (int i = 0; i < integerCount; i++)
		{
			int current = integers[i];
			if (indexMap.containsKey(current))
			{
				ArrayList<Integer> indexList = indexMap.get(current);
				indexList.add(i);
				indexMap.put(current, indexList);
			}
			else
			{
				ArrayList<Integer> initializer = new ArrayList<Integer> ();
				initializer.add(i);
				indexMap.put(current, initializer);
			}
		}

		ArrayList<Integer[]> solution = new ArrayList<Integer[]> ();
		for (Integer key : indexMap.keySet())
		{
			ArrayList<Integer> indexList = indexMap.get(key);
			int isProgression = isProgression(indexList);
			if (isProgression != -1)
			{
				solution.add(new Integer [] {key, isProgression});
			}
		}

		PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out), true);

		pw.println(solution.size());
		StringBuilder str = new StringBuilder();

		Collections.sort(solution, (s1,s2) ->  s1[0] - s2[0] );
		for (Integer [] sol : solution)
		{
			pw.println(sol[0] + " " + sol[1]);
		}

	}
}


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

public class JeffAndPeriods {
	static BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));

	static class Number
	{
		int value;
		int lastIndex;
		int commonDiff;
		boolean isAP;

		public Number(int value, int currentIndex)
		{
			this.value = value;
			this.lastIndex = currentIndex;
			this.commonDiff = 0;
			this.isAP = true;
		}

		public void updateLastIndex(int currentIndex)
		{
			if (this.commonDiff == 0)
			{
				this.commonDiff = currentIndex - this.lastIndex;
				this.lastIndex = currentIndex;
			}
			else if (this.commonDiff == currentIndex - this.lastIndex)
			{
				this.lastIndex = currentIndex;
			}
			else
			{
				this.isAP = false;
			}
		}

		public boolean isAP()
		{
			return this.isAP;
		}

		public int getCommonDiff()
		{
			return this.commonDiff;
		}
	}

	public static void main (String [] args) throws IOException
	{
		int integerCount = Integer.parseInt(reader.readLine());
		int [] integers = Arrays.stream(reader.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();

		TreeMap<Integer, Number> indexMap = new TreeMap<Integer, Number> ();
		for (int i = 0; i < integerCount; i++)
		{
			int current = integers[i];
			if (indexMap.containsKey(current))
			{
				Number num = indexMap.get(current);
				if (num.isAP())
				{
					num.updateLastIndex(i);
				}
			}
			else
			{
				Number num = new Number(current, i);
				indexMap.put(current, num);
			}
		}

		ArrayList<Integer[]> solution = new ArrayList<Integer[]> ();
		for (Integer key : indexMap.keySet())
		{
			if (indexMap.get(key).isAP())
			{
				solution.add(new Integer [] {key, indexMap.get(key).getCommonDiff()});
			}
		}

		PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out), true);
		pw.println(solution.size());
		for (Integer [] sol : solution)
		{
			pw.println(sol[0] + " " + sol[1]);
		}

	}
}


import java.util.*;

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

        int n = s.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = s.nextInt();
        }
        Set<Integer> set = new HashSet<>();
        TreeMap<Integer, Integer> map = new TreeMap<>();
        for (int i = 0; i < a.length; i++) {
            int d = -1;
            int count = 0;
            int prev = 0;
            int flag = 0;
            if (a[i] != -1) {
                for (int j = i + 1; j < a.length; j++) {
                    if (flag == 1) {
                        if (a[i] == a[j]) {
                            a[j] = -1;
                        }
                    } else if (a[i] == a[j]) {
                        if (d > 0) {
                            if (j - prev != d) {
                                d = -1;
                                flag = 1;
                                a[j] = -1;
                            } else {
                                prev = j;
                            }
                        } else {
                            d = j - i;
                            prev = j;
                        }
                        a[j] = -1;
                        count++;
                    }
                }
                if (d != -1 && flag == 0) {
                    set.add(a[i]);
                    map.put(a[i], d);
                } else if (d == -1 && count == 0 && flag == 0) {
                    set.add(a[i]);
                    map.put(a[i], 0);
                }

            }
            a[i] = -1;
        }

        System.out.println(map.size());

        for(int i : set){
            System.out.print(i+" ");
            System.out.println(map.get(i));
        }

    }
}


import java.util.*;

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

        int n = s.nextInt();
        int ar[] = new int[n + 1];

        int pos[] = new int[100007];
        int dif[] = new int[100007];

        int count = 0;

        for (int i = 1; i <= n; i++) {
            ar[i] = s.nextInt();

            if (pos[ar[i]] == 0) {
                count++;
                pos[ar[i]] = i;

            } else {

                int d = i - pos[ar[i]];

                if (dif[ar[i]] == -1)
                    continue;
                if (dif[ar[i]] == 0)
                    dif[ar[i]] = d;
                else if (dif[ar[i]] != d) {
                    count--;
                    dif[ar[i]] = -1;
                }
                pos[ar[i]] = i;
            }

        }

        System.out.println(count);
        for (int i = 1; i <= 100000; i++) {
            if (pos[i] > 0 && dif[i] != -1) {
                System.out.println(i + " " + dif[i]);

            }
        }
    }
}


import java.util.*;

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

        int n = s.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = s.nextInt();
        }
        ArrayList<Integer> list = new ArrayList<>();
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < a.length; i++) {
            int d = -1;
            int count = 0;
            int prev = 0;
            int flag = 0;
            if (a[i] != -1) {
                for (int j = i + 1; j < a.length; j++) {
                    if (flag == 1) {
                        if (a[i] == a[j]) {
                            a[j] = -1;
                        }
                    } else if (a[i] == a[j]) {
                        if (d > 0) {
                            if (j - prev != d) {
                                d = -1;
                                flag = 1;
                                a[j] = -1;
                            } else {
                                prev = j;
                            }
                        } else {
                            d = j - i;
                            prev = j;
                        }
                        a[j] = -1;
                        count++;
                    }
                }
                if (d != -1 && flag == 0) {
                    list.add(a[i]);
                    map.put(a[i], d);
                } else if (d == -1 && count == 0 && flag == 0) {
                    list.add(a[i]);
                    map.put(a[i], 0);
                }

            }
            a[i] = -1;
        }
        Collections.sort(list);
        System.out.println(list.size());
        for (int i = 0; i < list.size(); i++) {
            System.out.print(list.get(i) + " ");
            System.out.println(map.get(list.get(i)));

        }
    }
}


import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.InputMismatchException;

public class testing2 {

    public static void main(String[] args) throws IOException {
        InputReader in = new  InputReader();
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        solve(in, out);
        out.close();
    }

    private static void solve(InputReader s1, PrintWriter out) {

        int n=s1.nextInt();
        int ar[]=new int[n+1];

        int pos[]=new int[100007];
        int dif[]=new int[100007];

        int count=0;

        for(int i=1;i<=n;i++)
        {
            ar[i]=s1.nextInt();

            if(pos[ar[i]]==0)
            {
                count++;
                pos[ar[i]]=i;

            }
            else
            {

                int d=i-pos[ar[i]];

                if(dif[ar[i]]==-1)
                    continue;
                if(dif[ar[i]]==0)
                    dif[ar[i]]=d;
                else if(dif[ar[i]]!=d)
                {
                    count--;
                    dif[ar[i]]=-1;
                }
                pos[ar[i]]=i;
            }

        }

        out.println(count);
        for(int i=1;i<=100000;i++)
        {
            if(pos[i]>0&&dif[i]!=-1)
            {
               out.println(i+" "+dif[i]);

            }
        }
    }

    static class InputReader {
        private byte[] buf = new byte[16384];
        private int    curChar;
        private int    numChars;

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

        public String nextLine() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public 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 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 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 < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        public long[] nextLongArray(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }

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

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

}


import java.util.*;

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

        int n = s.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = s.nextInt();
        }
        ArrayList<Integer> list = new ArrayList<>();
        TreeMap<Integer, Integer> map = new TreeMap<>();
        for (int i = 0; i < a.length; i++) {
            int d = -1;
            int count = 0;
            int prev = 0;
            int flag = 0;
            if (a[i] != -1) {
                for (int j = i + 1; j < a.length; j++) {
                    if (flag == 1) {
                        if (a[i] == a[j]) {
                            a[j] = -1;
                        }
                    } else if (a[i] == a[j]) {
                        if (d > 0) {
                            if (j - prev != d) {
                                d = -1;
                                flag = 1;
                                a[j] = -1;
                            } else {
                                prev = j;
                            }
                        } else {
                            d = j - i;
                            prev = j;
                        }
                        a[j] = -1;
                        count++;
                    }
                }
                if (d != -1 && flag == 0) {
                    list.add(a[i]);
                    map.put(a[i], d);
                } else if (d == -1 && count == 0 && flag == 0) {
                    list.add(a[i]);
                    map.put(a[i], 0);
                }

            }
            a[i] = -1;
        }
        System.out.println(list.size());
        for (int i = 0; i < list.size(); i++) {
            System.out.print(list.get(i) + " ");
            System.out.println(map.get(list.get(i)));

        }
    }
}


import java.util.*;

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

        int n = s.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = s.nextInt();
        }
        ArrayList<Integer> list = new ArrayList<>();
        HashMap<Integer,Integer> map = new HashMap<>();
        for (int i = 0; i < a.length; i++) {
            int d = -1;
            int count = 0;
            int prev = 0;
            int flag = 0;
            if (a[i] != -1) {
                for (int j = i + 1; j < a.length; j++) {
                    if (a[i] == a[j]) {
                        if (d>0) {
                            if (j-prev!=d) {
                                d =-1;
                                flag = 1;
                                a[j] =-1;
                                break;
                            }
                            else{
                                prev = j;
                            }
                        } else {
                            d = j - i;
                            prev = j;
                        }
                        a[j] = -1;
                        count++;
                    }
                }
                if (d != -1&&flag==0) {
                    list.add(a[i]);
                    map.put(a[i],d);
                } else if (d == -1 && count == 0&&flag==0) {
                    list.add(a[i]);
                    map.put(a[i],0);
                }

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

        }
    }
}


import java.util.ArrayList;
import java.util.Scanner;

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

        int n = s.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = s.nextInt();
        }
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < a.length; i++) {
            int d = -1;
            int count = 0;
            int prev = 0;
            if (a[i] != -1) {
                for (int j = i + 1; j < a.length; j++) {
                    if (a[i] == a[j]) {
                        if (d>0) {
                            if (j-prev!=d) {
                                d = 0;
                            }
                            else{
                                prev = j;
                            }
                        } else {
                            d = j - i;
                            prev = j;
                        }
                        a[j] = -1;
                        count++;
                    }
                }
                if (d != -1) {
                    list.add(a[i]);
                    list.add(d);
                } else if (d == -1 && count == 0) {
                    list.add(a[i]);
                    list.add(0);
                }
            }
        }
        System.out.println(list.size()/2);
        for (int i = 1; i < list.size(); i=i+2) {
            System.out.print(list.get(i-1)+" ");
            System.out.println(list.get(i));
        }
    }
}


import java.util.*;

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

        int n = s.nextInt();
        int ar[] = new int[n + 1];
        int pos[] = new int[100007];
        int dif[] = new int[100007];
        int count = 0;
        for (int i = 1; i <= n; i++) {
            ar[i] = s.nextInt();
            if (pos[ar[i]] == 0) {
                count++;
                pos[ar[i]] = i;
            } else {

                int d = i - pos[ar[i]];

                if (dif[ar[i]] == -1)
                    continue;
                if (dif[ar[i]] == 0)
                    dif[ar[i]] = d;
                else if (dif[ar[i]] != d) {
                    count--;
                    dif[ar[i]] = -1;
                }
                pos[ar[i]] = i;
            }
        }
        System.out.println(count);
        for (int i = 1; i <= 100000; i++) {
            if (pos[i] > 0 && dif[i] != -1) {
                System.out.println(i + " " + dif[i]);

            }
        }
    }
}


import java.util.*;

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

        int n = s.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = s.nextInt();
        }
        ArrayList<Integer> list = new ArrayList<>();
        HashMap<Integer,Integer> map = new HashMap<>();
        for (int i = 0; i < a.length; i++) {
            int d = -1;
            int count = 0;
            int prev = 0;
            if (a[i] != -1) {
                for (int j = i + 1; j < a.length; j++) {
                    if (a[i] == a[j]) {
                        if (d>0) {
                            if (j-prev!=d) {
                                d = 0;
                            }
                            else{
                                prev = j;
                            }
                        } else {
                            d = j - i;
                            prev = j;
                        }
                        a[j] = -1;
                        count++;
                    }
                }
                if (d != -1) {
                    list.add(a[i]);
                    map.put(a[i],d);
                } else if (d == -1 && count == 0) {
                    list.add(a[i]);
                    map.put(a[i],0);
                }
            }
        }
        Collections.sort(list);
        System.out.println(list.size());
        for (int i = 0; i < list.size(); i++) {
            System.out.print(list.get(i)+" ");
            System.out.println(map.get(list.get(i)));

        }
    }
}


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

public class Main {

    public static void main(String[] args) throws IOException{
//        Scanner in = new Scanner(System.in);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // CODE HERE
        final int lengthOfSequence = Integer.parseInt(br.readLine());
        final String[] input = br.readLine().trim().split("\\s+");
        Integer[] sequence = new Integer[lengthOfSequence];
        for (int i = 0; i < lengthOfSequence; i++) {
            sequence[i] = Integer.parseInt(input[i]);
        }

        TreeMap<Integer, Integer> counter= new TreeMap<>();
        for (int i = 0; i < lengthOfSequence; i++) {
            if (counter.containsKey(sequence[i])){
                counter.put(sequence[i], counter.get(sequence[i]) + 1);
            }else {
                counter.put(sequence[i], 1);
            }
        }

        int count = 0;
        StringBuilder result = new StringBuilder();
        for (Map.Entry<Integer, Integer> map :
                counter.entrySet()) {
            if (map.getValue() == 1) {
                ++count;
                result.append(map.getKey());
                result.append(" ");
                result.append(0);
            }else {
                int progression = 0, index = 0;
                for (int i = 0; i < lengthOfSequence; i++) {
                    if (map.getKey().equals(sequence[i])) {
                        index = i;
                        break;
                    }
                }
                for (int i = index + 1; i < lengthOfSequence; i++) {
                    ++progression;
                    if (map.getKey().equals(sequence[i])){
                        ++count;
                        result.append(map.getKey());
                        result.append(" ");
                        result.append(progression);
                        break;
                    }
                    if (map.getKey().compareTo(sequence[i]) == -1 || sequence[i].equals(sequence[i+1])) {
                        System.out.println(0);
                        return;
                    }

                }
            }
            result.append('\n');
        }
        System.out.println(count + "\n"  + result.toString());
    }
}


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

public class Main {

    public static void main(String[] args) throws IOException{
//        Scanner in = new Scanner(System.in);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // CODE HERE
        final int lengthOfSequence = Integer.parseInt(br.readLine());
        final String[] input = br.readLine().trim().split("\\s+");
        Integer[] sequence = new Integer[lengthOfSequence];
        for (int i = 0; i < lengthOfSequence; i++) {
            sequence[i] = Integer.parseInt(input[i]);
        }

        TreeMap<Integer, Integer> counter= new TreeMap<>();
        for (int i = 0; i < lengthOfSequence; i++) {
            if (counter.containsKey(sequence[i])){
                counter.put(sequence[i], counter.get(sequence[i]) + 1);
            }else {
                counter.put(sequence[i], 1);
            }
        }

        int count = 0;
        StringBuilder result = new StringBuilder();
        for (Map.Entry<Integer, Integer> map :
                counter.entrySet()) {
            if (map.getValue() == 1) {
                ++count;
                result.append(map.getKey());
                result.append(" ");
                result.append(0);
            }else {
                int progression = 0, index = 0;
                for (int i = 0; i < lengthOfSequence; i++) {
                    if (map.getKey().equals(sequence[i])) {
                        index = i;
                        break;
                    }
                }
                for (int i = index + 1; i < lengthOfSequence; i++) {
                    ++progression;
                    if (map.getKey().equals(sequence[i])){
                        ++count;
                        result.append(map.getKey());
                        result.append(" ");
                        result.append(progression);
                        break;
                    }
                }
            }
            result.append('\n');
        }
        System.out.println(count + "\n"  + result.toString());
    }
}


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

public class Main {

    public static void main(String[] args) throws IOException{
//        Scanner in = new Scanner(System.in);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // CODE HERE
        final int lengthOfSequence = Integer.parseInt(br.readLine());
        final String[] input = br.readLine().trim().split("\\s+");
        Integer[] sequence = new Integer[lengthOfSequence];
        for (int i = 0; i < lengthOfSequence; i++) {
            sequence[i] = Integer.parseInt(input[i]);
        }

        TreeMap<Integer, Integer> counter= new TreeMap<>();
        for (int i = 0; i < lengthOfSequence; i++) {
            if (counter.containsKey(sequence[i])){
                counter.put(sequence[i], counter.get(sequence[i]) + 1);
            }else {
                counter.put(sequence[i], 1);
            }
        }

        int count = 0;
        boolean flag = false;
        StringBuilder result = new StringBuilder();
        Set<Integer> progression = new HashSet<>();
        for (Map.Entry<Integer, Integer> map :
                counter.entrySet()) {
            if (map.getValue() == 1) {
                ++count;
                result.append(map.getKey());
                result.append(" ");
                result.append(0);
                result.append('\n');
            }else {
                int progressionIndex = 0, index = 0;
                for (int i = 0; i < lengthOfSequence; i++) {
                    if (map.getKey().equals(sequence[i])) {
                        index = i;
                        break;
                    }
                }
                for (int i = index + 1; i < lengthOfSequence; i++) {
                    ++progressionIndex;
                    if (map.getKey().equals(sequence[i])){
                        progression.add(progressionIndex);
                        progressionIndex = 0;
                    }
                }
                if (progression.size() == 1){
                    ++count;
                    result.append(map.getKey());
                    result.append(" ");
                    result.append(progression.iterator().next());
                    result.append('\n');
                }
                progression.clear();
            }
        }

        System.out.println(count + "\n"  + result.toString());
    }
}


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

public class Main {

    public static void main(String[] args) throws IOException{
//        Scanner in = new Scanner(System.in);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // CODE HERE
        final int lengthOfSequence = Integer.parseInt(br.readLine());
        final String[] input = br.readLine().trim().split("\\s+");
        Integer[] sequence = new Integer[lengthOfSequence];
        for (int i = 0; i < lengthOfSequence; i++) {
            sequence[i] = Integer.parseInt(input[i]);
        }

        TreeMap<Integer, Integer> counter= new TreeMap<>();
        for (int i = 0; i < lengthOfSequence; i++) {
            if (counter.containsKey(sequence[i])){
                counter.put(sequence[i], counter.get(sequence[i]) + 1);
            }else {
                counter.put(sequence[i], 1);
            }
        }

        int count = 0;
        StringBuilder result = new StringBuilder();
        for (Map.Entry<Integer, Integer> map :
                counter.entrySet()) {
            if (map.getValue() == 1) {
                ++count;
                result.append(map.getKey());
                result.append(" ");
                result.append(0);
            }else {
                int progression = 0, index = 0;
                for (int i = 0; i < lengthOfSequence; i++) {
                    if (map.getKey().equals(sequence[i])) {
                        index = i;
                        break;
                    }
                }
                for (int i = index + 1; i < lengthOfSequence; i++) {
                    ++progression;
                    if (map.getKey().equals(sequence[i])){
                        ++count;
                        result.append(map.getKey());
                        result.append(" ");
                        result.append(progression);
                        break;
                    }
                    if (sequence[i].equals(sequence[i + 1])) {
                        System.out.println(0);
                        return;
                    }
                }
            }
            result.append('\n');
        }
        System.out.println(count + "\n"  + result.toString());
    }
}


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

public class Main {

    // SOLVER
    static void solve() {
        // INPUT OUTPUT
        InputReader in = new InputReader(System.in);
        PrintWriter pw = new PrintWriter(System.out);

        // SOLVE
        final int lengthOfSequence = in.nextInt();
        final Integer[] sequenceElement = new Integer[lengthOfSequence];
        Integer[] sequence = new Integer[100001];
        Arrays.fill(sequence, 0);
        Integer[] visitedNumber = new Integer[100001];
        Arrays.fill(visitedNumber, -1);
        Integer[] progression = new Integer[100001];
        Arrays.fill(progression, -1);
        int temp = 0;

        for (int i = 0; i < lengthOfSequence; i++) {
            temp = in.nextInt();
            sequenceElement[i] = temp;
            if (sequence[temp] == 0 && visitedNumber[temp] == -1) {
                visitedNumber[temp] = 1;
                sequence[temp] = i;
                progression[temp] = 0;
                continue;
            }
            if (sequence[temp] == 0 && visitedNumber[temp] == 1) {
                visitedNumber[temp] += 1;
                progression[temp] = i - sequence[temp];
                sequence[temp] = i;
                continue;
            }
            if (sequence[temp] > 0) {
                if (progression[temp] == 0) {
                    visitedNumber[temp] += 1;
                    progression[temp] = i - sequence[temp];
                    sequence[temp] = i;
                    continue;
                }
                if (progression[temp] > 0) {
                    if (i - sequence[temp] == progression[temp]) {
                        visitedNumber[temp] += 1;
                        sequence[temp] = i;
                        continue;
                    } else {
                        progression[temp] = -1;
                    }
                }
            }
        }
        Set<Integer> uniqueElement = new TreeSet<>(Arrays.asList(sequenceElement));
        uniqueElement.remove(0);

        StringBuilder result = new StringBuilder();
        int count = 0;
        for (Integer a : uniqueElement) {
            if (progression[a].compareTo(0) == -1) {
                continue;
            } else {
                ++count;
                result.append(a);
                result.append(" ");
                result.append(progression[a]);
                result.append('\n');
            }
        }
        if (count == 0) {
            pw.println(count);
        } else {
            pw.println(count + "\n" + result.toString());
        }

        {
            pw.close();
        }
    }

    // DRIVER CODE
    public static void main(String[] args) {
        solve();
    }

    // FAST INPUT
    static class InputReader {

        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private SpaceCharFilter filter;

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

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

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

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

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        public String readString() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public String nextLine() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

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

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


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

public class Main {

    public static void main(String[] args) throws IOException{
//        Scanner in = new Scanner(System.in);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // CODE HERE
        final int lengthOfSequence = Integer.parseInt(br.readLine());
        final String[] input = br.readLine().trim().split("\\s+");
        final Integer[] sequenceElement = new Integer[lengthOfSequence];
        Integer[] sequence = new Integer[100001];
        Arrays.fill(sequence, 0);
        Integer[] visitedNumber = new Integer[100001];
        Arrays.fill(visitedNumber, -1);
        Integer[] progression = new Integer[100001];
        Arrays.fill(progression, -1);
        int temp = 0;
        for (int i = 0; i < lengthOfSequence; i++) {
            temp = Integer.parseInt(input[i]);
            sequenceElement[i] = temp;
            if (sequence[temp] == 0 && visitedNumber[temp] == -1) {
                visitedNumber[temp] = 1;
                sequence[temp] = i;
                progression[temp] = 0;
                continue;
            }
            if (sequence[temp] == 0 && visitedNumber[temp] == 1) {
                visitedNumber[temp] += 1;
                progression[temp] = i - sequence[temp];
                sequence[temp] = i;
                continue;
            }
            if (sequence[temp] > 0){
                if (progression[temp] == 0){
                    visitedNumber[temp] += 1;
                    progression[temp] = i -sequence[temp];
                    sequence[temp] = i;
                    continue;
                }
                if (progression[temp] > 0){
                    if (i - sequence[temp] == progression[temp]){
                        visitedNumber[temp] += 1;
                        sequence[temp] = i;
                        continue;
                    }else {
                        progression[temp] = -1;
                    }
                }
            }
        }

        Set<Integer> uniqueElement = new TreeSet<>(Arrays.asList(sequenceElement));
        uniqueElement.remove(0);

        StringBuilder result = new StringBuilder();
        int count = 0;
        for (Integer a :
                uniqueElement) {
            if (progression[a].compareTo(0) == -1) {
                continue;
            }else {
                ++count;
                result.append(a);
                result.append(" ");
                result.append(progression[a]);
                result.append('\n');
            }
        }
        if (count == 0){
            System.out.println(count);
        }else {
            System.out.println(count + "\n" + result.toString());
        }
    }
}


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

public class Main {

    public static void main(String[] args) throws IOException{
//        Scanner in = new Scanner(System.in);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // CODE HERE
        final int lengthOfSequence = Integer.parseInt(br.readLine());
        final String[] input = br.readLine().trim().split("\\s+");
        Integer[] sequence = new Integer[lengthOfSequence];
        for (int i = 0; i < lengthOfSequence; i++) {
            sequence[i] = Integer.parseInt(input[i]);
        }

        TreeMap<Integer, Integer> counter= new TreeMap<>();
        for (int i = 0; i < lengthOfSequence; i++) {
            if (counter.containsKey(sequence[i])){
                counter.put(sequence[i], counter.get(sequence[i]) + 1);
            }else {
                counter.put(sequence[i], 1);
            }
        }

        int count = 0;
        boolean flag = false;
        StringBuilder result = new StringBuilder();
        Set<Integer> progression = new HashSet<>();
        for (Map.Entry<Integer, Integer> map :
                counter.entrySet()) {
            if (map.getValue() == 1) {
                ++count;
                result.append(map.getKey());
                result.append(" ");
                result.append(0);
                result.append('\n');
            }else {
                int progressionIndex = 0, index = 0;
                for (int i = 0; i < lengthOfSequence; i++) {
                    if (map.getKey().equals(sequence[i])) {
                        index = i;
                        break;
                    }
                }
                for (int i = index + 1; i < lengthOfSequence; i++) {
                    ++progressionIndex;
                    if (map.getKey().equals(sequence[i])){
                        progression.add(progressionIndex);
                        progressionIndex = 0;
                    }
                }
                if (progression.size() == 1){
                    ++count;
                    result.append(map.getKey());
                    result.append(" ");
                    result.append(progression.iterator().next());
                    result.append('\n');
                    progression.clear();
                }
            }
        }

        System.out.println(count + "\n"  + result.toString());
    }
}


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

/* Name of the class has to be "Main" only if the class is public. */

public class Main
{

    static PrintWriter out;

	static class FastReader{
		BufferedReader br;
		StringTokenizer st;
		public FastReader(){
			br=new BufferedReader(new InputStreamReader(System.in));
			out=new PrintWriter(System.out);
		}
		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;
		}
	}

// SHIVAM GUPTA :

// ASCII = 48 + i ;

public static void main (String[] args) throws java.lang.Exception
{
  FastReader scn = new FastReader() ;

 int input = scn.nextInt() ;

 int n = 100000 ;

 int[][] arr = new int[2][n+1] ;

 for(int i = 1 ; i < n+1  ; i++ )
 {
       arr[0][i] = -1  ;
 }

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

 for(int i = 1 ; i <= input ; i++)
 {
  int x = scn.nextInt();

  if(arr[0][x] == -1)
  {
  arr[0][x]= i+ 1 ;

  }

  else{
        if(arr[1][x] == -1)
        {
              continue  ;
        }

        else if(arr[1][x] == 0)
        {

            arr[1][x] = i+ 1 - arr[0][x] ;
            arr[0][x] =  i+1  ;
        }
        else{

            if((i+1 - arr[0][x] ) == arr[1][x])
            {
              arr[0][x] =  i+1  ;
            }
            else{

               arr[1][x] = -1 ;

            }

        }

  }

 }

 ArrayList<Integer> list = new ArrayList<>() ;
 int count = 0 ;

 for(int i = 1; i < n+1  ; i++)
 {
       if(arr[1][i] != -1 && arr[0][i] != -1)
       {
             count++ ;
             list.add(i) ;list.add(arr[1][i]) ;
       }

 }

out.println(count) ;

for(int i = 0; i< list.size() ; i++ )
{
      out.println(list.get(i) + " "  + list.get(i+1) ) ;
      i++ ;
}

out.flush() ;

}

}


import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Solution {
    // Complete the maximumSum function below.
    public static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(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 String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        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 < '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 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 String readString() {
            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 c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

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

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

    public static long gcd(long a, long b) {
        if (b == 0)
            return a;
        long r = a % b;
        return gcd(b, r);
    }

    static long lcm(long a, long b) {
        return (a * b) / gcd(a, b);
    }

    public class ListNode {
        int val;
        ListNode next;

        ListNode() {
        }

        ListNode(int val) {
            this.val = val;
        }

        ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    }

    public class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode() {
        }

        TreeNode(int val) {
            this.val = val;
        }

        TreeNode(int val, TreeNode left, TreeNode right) {
            this.val = val;
            this.left = left;
            this.right = right;
        }
    }

    class Node {
        public int val;
        public List<Node> children;

        public Node() {
        }

        public Node(int _val) {
            val = _val;
        }

        public Node(int _val, List<Node> _children) {
            val = _val;
            children = _children;
        }
    }

    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader scanner = new InputReader(inputStream);
        PrintWriter w = new PrintWriter(outputStream);
        int m = scanner.nextInt();
        boolean as=false;
        HashMap<Integer,List<Integer>> x=new HashMap<>();
        for(int i=0;i<m;i++){
            int a=scanner.nextInt();
            if(x.containsKey(a)){
                x.get(a).add(i);
                if((x.get(a).get(1)-x.get(a).get(0))!=(x.get(a).get(x.get(a).size()-1)-x.get(a).get(x.get(a).size()-2))) {
                    as = true;
                }
            }
            else {
                List<Integer> ps=new ArrayList<>();
                ps.add(i);
                x.put(a, ps);
            }
        }
        if(as)
            w.println(0);
        else
        {
            w.println(x.size());
            for(Map.Entry<Integer,List<Integer>> i:x.entrySet()){
                if(i.getValue().size()==1)
                    w.println(i.getKey()+" "+0);
                else
                    w.println(i.getKey()+" "+(i.getValue().get(1)-i.getValue().get(0)));
            }
        }
        w.close();
    }
}


import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Solution {
    // Complete the maximumSum function below.
    public static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(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 String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        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 < '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 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 String readString() {
            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 c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

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

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

    public static long gcd(long a, long b) {
        if (b == 0)
            return a;
        long r = a % b;
        return gcd(b, r);
    }

    static long lcm(long a, long b) {
        return (a * b) / gcd(a, b);
    }

    public class ListNode {
        int val;
        ListNode next;

        ListNode() {
        }

        ListNode(int val) {
            this.val = val;
        }

        ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    }

    public class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode() {
        }

        TreeNode(int val) {
            this.val = val;
        }

        TreeNode(int val, TreeNode left, TreeNode right) {
            this.val = val;
            this.left = left;
            this.right = right;
        }
    }

    class Node {
        public int val;
        public List<Node> children;

        public Node() {
        }

        public Node(int _val) {
            val = _val;
        }

        public Node(int _val, List<Node> _children) {
            val = _val;
            children = _children;
        }
    }

    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader scanner = new InputReader(inputStream);
        PrintWriter w = new PrintWriter(outputStream);
        int m = scanner.nextInt();
        int arr[] = new int[m];
        Set<Integer> op=new HashSet<>();
        for (int i = 0; i < m; i++) {
            arr[i] = scanner.nextInt();
            op.add(arr[i]);
        }
        Arrays.sort(arr);
        int x=0;
        w.println(op.size());
        for(int i=0;i<arr.length;i++){
            if(x!=arr[i]){
                x=arr[i];
                w.println(x+" "+0);
            }
        }
        w.close();
    }
}


import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Solution {
    // Complete the maximumSum function below.
    public static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(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 String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        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 < '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 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 String readString() {
            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 c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

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

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

    public static long gcd(long a, long b) {
        if (b == 0)
            return a;
        long r = a % b;
        return gcd(b, r);
    }

    static long lcm(long a, long b) {
        return (a * b) / gcd(a, b);
    }

    public class ListNode {
        int val;
        ListNode next;

        ListNode() {
        }

        ListNode(int val) {
            this.val = val;
        }

        ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    }

    public class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode() {
        }

        TreeNode(int val) {
            this.val = val;
        }

        TreeNode(int val, TreeNode left, TreeNode right) {
            this.val = val;
            this.left = left;
            this.right = right;
        }
    }

    class Node {
        public int val;
        public List<Node> children;

        public Node() {
        }

        public Node(int _val) {
            val = _val;
        }

        public Node(int _val, List<Node> _children) {
            val = _val;
            children = _children;
        }
    }

    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader scanner = new InputReader(inputStream);
        PrintWriter w = new PrintWriter(outputStream);
        int m = scanner.nextInt();
        int arr[] = new int[m];
        for (int i = 0; i < m; i++)
            arr[i] = scanner.nextInt();
        Arrays.sort(arr);
        int x=0;
        for(int i=0;i<arr.length;i++){
            if(x!=arr[i]){
                x=arr[i];
                w.println(x+" "+0);
            }
        }
        w.close();
    }
}


import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Solution {
    // Complete the maximumSum function below.
    public static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(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 String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        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 < '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 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 String readString() {
            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 c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

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

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

    public static long gcd(long a, long b) {
        if (b == 0)
            return a;
        long r = a % b;
        return gcd(b, r);
    }

    static long lcm(long a, long b) {
        return (a * b) / gcd(a, b);
    }

    public class ListNode {
        int val;
        ListNode next;

        ListNode() {
        }

        ListNode(int val) {
            this.val = val;
        }

        ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    }

    public class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode() {
        }

        TreeNode(int val) {
            this.val = val;
        }

        TreeNode(int val, TreeNode left, TreeNode right) {
            this.val = val;
            this.left = left;
            this.right = right;
        }
    }

    class Node {
        public int val;
        public List<Node> children;

        public Node() {
        }

        public Node(int _val) {
            val = _val;
        }

        public Node(int _val, List<Node> _children) {
            val = _val;
            children = _children;
        }
    }

    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader scanner = new InputReader(inputStream);
        PrintWriter w = new PrintWriter(outputStream);
        int m = scanner.nextInt();
        boolean as=false;
        TreeMap<Integer,List<Integer>> x=new TreeMap<>();
        for(int i=0;i<m;i++){
            int a=scanner.nextInt();
            if(x.containsKey(a)){
                x.get(a).add(i);
                if((x.get(a).get(1)-x.get(a).get(0))!=(x.get(a).get(x.get(a).size()-1)-x.get(a).get(x.get(a).size()-2))) {
                    as = true;
                }
            }
            else {
                List<Integer> ps=new ArrayList<>();
                ps.add(i);
                x.put(a, ps);
            }
        }
        List<List<Integer>> ans=new ArrayList<>();
            for(Map.Entry<Integer,List<Integer>> i:x.entrySet()){
                if(i.getValue().size()==1) {
                    List<Integer> aps=new ArrayList<>();
                    aps.add(i.getKey());
                    aps.add(0);
                    ans.add(aps);
                }
                else if(!as) {
                    List<Integer> aps=new ArrayList<>();
                    aps.add(i.getKey());
                    aps.add(i.getValue().get(1) - i.getValue().get(0));
                    ans.add(aps);
                }
            }
            w.println(ans.size());
            for(List<Integer> i:ans)
                w.println(i.get(0)+" "+i.get(1));
        w.close();
    }
}