Problem:
Score : 300 points

Problem Statement

You drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.

How many kinds of items did you get?

Constraints

1 \leq N \leq 2\times 10^5

S_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).

Input

Input is given from Standard Input in the following format:

N
S_1
:
S_N

Output

Print the number of kinds of items you got.

Sample Input 1

3
apple
orange
apple

Sample Output 1

2

You got two kinds of items: apple and orange.

Sample Input 2

5
grape
grape
grape
grape
grape

Sample Output 2

1

Sample Input 3

4
aaaa
a
aaa
aa

Sample Output 3

4

Solution in C (GCC 9.2.1) (judge verdict: Accepted)

#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;
}