import java.io.*;
import java.util.*;

public class MaartenTrie {
    public static void main(String[] args) throws IOException {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            new MaartenTrie().run(reader);
        }
    }

    public void run(BufferedReader reader) throws IOException {
        String[] firstLine = reader.readLine().split(" ");
        int n = Integer.parseInt(firstLine[0]);
        int l = Integer.parseInt(firstLine[1]);

        Trie trie = new Node();
        for (int j = 0; j < n; j++) {
            char[] name = reader.readLine().toCharArray();
            Trie curr = trie;
            for (int i = 0; i < name.length; i++) {
                int c = name[i] - 'a';
                assert curr instanceof Node;
                Node node = (Node) curr;
                if (node.children[c] == null) {
                    node.children[c] = new Leaf(Arrays.copyOfRange(name, i + 1, name.length));
                    break;
                }
                if (node.children[c] instanceof Leaf oldChild) { // Pattern match variable, since Java 16
                    char[] rest = oldChild.rest;
                    // char[] rest = ((Leaf) node.children[c]).rest; // Use this line in case Java 16 is not supported
                    Node newChild = new Node();
                    newChild.children[rest[0] - 'a'] = new Leaf(Arrays.copyOfRange(rest, 1, rest.length));
                    node.children[c] = newChild;
                }
                curr = node.children[c];
            }
        }

        System.out.println(trie.chars());
    }

    static abstract class Trie {
        abstract int size();

        abstract int chars();
    }

    static class Leaf extends Trie {
        char[] rest;

        public Leaf(char[] rest) {
            this.rest = rest;
        }

        @Override
        int size() {
            return 1;
        }

        @Override
        int chars() {
            return 0;
        }
    }

    static class Node extends Trie {
        Trie[] children = new Trie[26];
        int size = -1, chars = -1;

        @Override
        int size() {
            if (size == -1) {
                size = 0;
                for (Trie child : children) {
                    if (child == null) continue;
                    size += child.size();
                }
            }
            return size;
        }

        @Override
        int chars() {
            if (chars == -1) {
                chars = 0;
                for (Trie child : children) {
                    if (child == null) continue;
                    chars += child.chars() + child.size();
                }
            }
            return chars;
        }
    }
}
