Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a description of a graph.

It is an undirected weighted graph on n vertices. It is a complete graph: each pair of vertices is connected by an edge. The weight of each edge is either 0 or 1; exactly m edges have weight 1, and all others have weight 0.

Since Ujan doesn't really want to organize his notes, he decided to find the weight of the minimum spanning tree of the graph. (The weight of a spanning tree is the sum of all its edges.) Can you find the answer for Ujan so he stops procrastinating?

Input

The first line of the input contains two integers n and m (1 ≤ n ≤ 10^5, 0 ≤ m ≤ min((n(n-1))/(2),10^5)), the number of vertices and the number of edges of weight 1 in the graph. 

The i-th of the next m lines contains two integers a_i and b_i (1 ≤ a_i, b_i ≤ n, a_i ≠ b_i), the endpoints of the i-th edge of weight 1.

It is guaranteed that no edge appears twice in the input.

Output

Output a single integer, the weight of the minimum spanning tree of the graph.

Examples

Input


6 11
1 3
1 4
1 5
1 6
2 3
2 4
2 5
2 6
3 4
3 5
3 6


Output


2


Input


3 0


Output


0

Note

The graph from the first sample is shown below. Dashed edges have weight 0, other edges have weight 1. One of the minimum spanning trees is highlighted in orange and has total weight 2.

<image>

In the second sample, all edges have weight 0 so any spanning tree has total weight 0.
import java.io.*;
import java.util.*;

public class B {

	static SegmentTree tree;

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner();
		PrintWriter out = new PrintWriter(System.out);
		int n = sc.nextInt(), m = sc.nextInt();
		ArrayList<Integer>[] adj = new ArrayList[n];
		for (int i = 0; i < n; i++)
			adj[i] = new ArrayList();
		while (m-- > 0) {
			int u = sc.nextInt() - 1, v = sc.nextInt() - 1;
			adj[Math.min(u, v)].add(Math.max(u, v));
		}
		tree = new SegmentTree(n);
		for (int i = 0; i < n; i++)
			tree.update(i, i);
		DSU dsu = new DSU(n);
		int connected = 0;
		for (int i = 0; i < n; i++) {
			Collections.sort(adj[i]);

			int nxt = i + 1;
			for (int v : adj[i]) {
				if (v == nxt) {
					nxt = v + 1;
					continue;
				}
				int l = nxt, r = v - 1;
				while (true) {
					int uCol = tree.query(i);
					int canConnect = tree.query(l, r, uCol);
					if (canConnect == -1)
						break;
					dsu.union(i, canConnect);

					connected++;
				}
				nxt = v + 1;

			}
			int l = nxt, r = n - 1;
			while (true) {
				int uCol = tree.query(i);
				int canConnect = tree.query(l, r, uCol);
				if (canConnect == -1)
					break;
				dsu.union(i, canConnect);

				connected++;
			}

		}
		out.println(n - 1 - connected);
		out.close();

	}

	static class SegmentTree {
		int[] min, max;
		int n;

		SegmentTree(int n) {
			this.n = n;
			min = new int[4 * n];
			max = new int[4 * n];
		}

		public int query(int idx) {
			// TODO Auto-generated method stub
			return query(1, 0, n - 1, idx);
		}

		int query(int node, int tl, int tr, int idx) {
			if (tl == tr) {
				return min[node];
			} else {
				int mid = tl + tr >> 1, left = node << 1, right = left | 1;
				if (idx <= mid)
					return query(left, tl, mid, idx);
				else
					return query(right, mid + 1, tr, idx);

			}
		}

		public int query(int l, int r, int v) {
			return query(1, 0, n - 1, l, r, v);
		}

		int query(int node, int tl, int tr, int l, int r, int v) {
			if (tr < l || r < tl || (max[node] == v && min[node] == v))
				return -1;
			if (tl == tr)
				return tl;
			int mid = tl + tr >> 1, left = node << 1, right = left | 1;
			int x = query(left, tl, mid, l, r, v);
			if (x != -1)
				return x;
			return query(right, mid + 1, tr, l, r, v);

		}

		void update(int idx, int v) {
			update(1, 0, n - 1, idx, v);
		}

		void update(int node, int tl, int tr, int idx, int v) {
			if (tl == tr) {
				min[node] = max[node] = v;
			} else {
				int mid = tl + tr >> 1, left = node << 1, right = left | 1;
				if (idx <= mid)
					update(left, tl, mid, idx, v);
				else
					update(right, mid + 1, tr, idx, v);
				min[node] = Math.min(min[left], min[right]);
				max[node] = Math.max(max[left], max[right]);
			}
		}
	}

	static class DSU {
		ArrayList<Integer>[] sets;
		int[] id;

		DSU(int n) {
			sets = new ArrayList[n];
			id = new int[n];
			for (int i = 0; i < n; i++) {
				id[i] = i;
				sets[i] = new ArrayList();
				sets[i].add(i);
			}
		}

		int union(int i, int j) {
			i = id[i];
			j = id[j];
			ArrayList<Integer> small, large;
			int newId;
			if (sets[i].size() < sets[j].size()) {
				small = sets[i];
				large = sets[j];
				newId = j;
			} else {
				small = sets[j];
				large = sets[i];
				newId = i;
			}
			for (int x : small) {
				large.add(x);
				id[x] = newId;
				tree.update(x, newId);
			}
			return i;
		}
	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

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

		Scanner(String fileName) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(fileName));
		}

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

		String nextLine() throws IOException {
			return br.readLine();
		}

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

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		boolean ready() throws IOException {
			return br.ready();
		}

	}

	static void sort(int[] a) {
		shuffle(a);
		Arrays.sort(a);
	}

	static void shuffle(int[] a) {
		int n = a.length;
		Random rand = new Random();
		for (int i = 0; i < n; i++) {
			int tmpIdx = rand.nextInt(n);
			int tmp = a[i];
			a[i] = a[tmpIdx];
			a[tmpIdx] = tmp;
		}
	}

}