#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M), b(M), c(M);
  for (int i = 0; i < M; i++) {
    cin >> a[i] >> b[i] >> c[i];
  }
  cout << N - M + 1 << endl;
  return 0;
}
