#include #include using namespace std; using namespace atcoder; typedef modint998244353 mint; typedef long long ll; int main(){ int n, m; cin >> n >> m; mcf_graph mcf(4*n + 2); for (int i=0; i0) mcf.add_edge(n+i, 3*n+i-1, 1, 2); mcf.add_edge(2*n+i, i, 1, 0); mcf.add_edge(3*n+i, i, 1, 0); } for (int i=0; i> u >> v; u--; v--; mcf.add_edge(n+u, v, 1, 0); mcf.add_edge(n+v, u, 1, 0); } auto fl = mcf.flow(4*n, 4*n+1); cout << n - fl.second << endl; }