#include <bits/stdc++.h>
int main() {
  int n, q, i, j, r;
  int *gn;
  int *gn_new;
  char *str;
  char l, d;
  scanf("%d %d", &n, &q);
  str = (char *)malloc(n + 1);
  scanf("%s", str);
  gn = (int *)malloc(n * sizeof(int));
  for (j = 0; j < n; j++) gn[j] = 1;
  for (i = 0; i < q; i++) {
    gn_new = (int *)calloc(n, sizeof(int));
    scanf("%c", &l);
    if (l != '\n') ungetc(l, stdin);
    scanf("%c %c", &l, &d);
  }
  r = 0;
  for (j = 0; j < n; j++) r += gn[j];
  printf("%d", r);
  return 0;
}
