#include <bits/stdc++.h>   using namespace std;   vector<int> adj[200005];   int visited[200005];   int dfs(int u) {     visited[u] = 1;     int iscycle = ((adj[u].size() == 2) ? (1) : (0));     for (int i = 0; i < adj[u].size(); ++i) {       if (visited[adj[u][i]] == 0 and dfs(adj[u][i]) == 0) iscycle = 0;     }     return iscycle;   }   int main() {     int n, m;     scanf( %d%d , &n, &m);     for (int i = 0; i < m; ++i) {       int u, v;       scanf( %d%d , &u, &v);       adj[u].push_back(v);       adj[v].push_back(u);     }     for (int i = 0; i <= n; ++i) visited[i] = 0;     int ans = 0;     for (int i = 1; i <= n; ++i)       if (visited[i] == 0) ans += dfs(i);     printf( %d n , ans);   }   