public void solve() throws IOException {
    int n = nextInt();
    int total = 0;
    for (int x = 0; x < n; x++) {
      char[] bat = nextToken().toCharArray();
      boolean won = true;
      for (int y = 0; y < bat.length - 1; y++)
        if (bat[y] == 'C' && bat[y + 1] == 'D')
          won = false;
      if (won)
        total++;
    }
    System.out.println(total);
  }