#include<stdio.h>
char s[200005][16];
int comp(char s[], char t[])
{
	int i = 0;
	while (s[i] != '\0')
	{
		if (t[i] == '\0')
			return 1;
		if (s[i] < t[i])
			return -1;
		if (s[i] > t[i])
			return 1;
		i++;
	}
	if (t[i] != '\0')
		return -1;
	return 0;
}
int h[200005], l;
void swap_h(int a, int b)
{
	int f = h[a];
	h[a] = h[b];
	h[b] = f;
	return;
}
int comp_h(int a, int b)
{
	return comp(s[h[a]], s[h[b]]);
}
void f1(int n)
{
	h[l] = n;
	int p = l;
	l++;
	while (p > 0)
	{
		if (comp_h((p - 1) / 2, p) > 0)
			swap_h((p - 1) / 2, p);
		p = (p - 1) / 2;
	}
	return;
}
int f2()
{
	l--;
	swap_h(0, l);
	int p = 0;
	for (;;)
	{
		if (2 * p + 2 < l)
		{
			if (comp_h(2 * p + 1, 2 * p + 2) > 0)
			{
				if (comp_h(p, 2 * p + 2) > 0)
					swap_h(p, 2 * p + 2);
				p = 2 * p + 2;
			}
			else
			{
				if (comp_h(p, 2 * p + 1) > 0)
					swap_h(p, 2 * p + 1);
				p = 2 * p + 1;
			}
		}
		else if (2 * p + 1 < l)
		{
			if (comp_h(p, 2 * p + 1) > 0)
				swap_h(p, 2 * p + 1);
			p = 2 * p + 1;
		}
		else
			break;
	}
	return h[l];
}
int main()
{
	int n;
	scanf("%d", &n);

	int i;
	for (i = 0; i < n; i++)
		scanf("%s", s[i]);
	l = 0;
	for (i = 0; i < n; i++)
		f1(i);
	int c[200005];
	for (i = 0; i < n; i++)
		c[i] = f2();
	int ans = 1;
	for (i = 1; i < n; i++)
		if (comp(s[c[i - 1]], s[c[i]]) < 0)
			ans++;
	printf("%d\n", ans);
	return 0;
}