#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, q;
  string s;
  cin >> n >> q >> s;
  char t, d;
  int count_g[n];
  for (int i = 0; i < n; i++) count_g[i] = 1;
  for (int i = 0; i < q; i++) {
    cin >> t >> d;
  }
  int sum = 0;
  for (int x : count_g) sum += x;
  cout << sum << endl;
  return 0;
}
