#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0), cin.tie(0);     int n, m;     cin >> n >> m;     vector<vector<int>> adj(n);     for (int i = 0, u, v; i < m; ++i) {       cin >> u >> v;       --u, --v;       adj[u].push_back(v);       adj[v].push_back(u);     }     set<int> go;     queue<int> q;     for (int i = 0; i < n; ++i) go.insert(i);     int ans = 0;     for (int x = 0; x < n; ++x)       if (go.find(x) != go.end()) {         ++ans;         go.erase(x);         q.push(x);         while (!q.empty()) {           int u = q.front();           q.pop();           vector<int> add;           for (auto v : adj[u])             if (go.find(v) != go.end()) {               go.erase(v);               add.push_back(v);             }           for (auto v : go) q.push(v);           go.clear();           for (auto v : add) go.insert(v);         }       }     cout << ans - 1 <<   n ;     return 0;   }   