#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int condition(char *buf, char *s){
	/*data が key 以上であれば、1を返し、key未満であれば0を返す。*/
	if(strcmp(buf, s) >= 0){
		return 1;
	}
	return 0;
}

int myAbs(int a){
	if(a < 0) a = -a;
	return a;
}

int MeguruBinarySearch(char **buf, int size, char *key){
	/*二分探索で条件を満たすindexを探す*/
	/*condition の条件式がdataがkey以上になるとokが更新されるので、key以上となる最小のindexをかえす。*/
	int ng = -1;
	int ok = size;
	int mid;
	while(myAbs(ok - ng) > 1){
		mid = (ok + ng)/2;
		
		if(condition(buf[mid], key)) ok = mid;
		else ng = mid;
	}
	return ok;
}

void insert(char ** buf, char *s, int k){
	int i = 0, j = 0;
	i = MeguruBinarySearch(buf, k, s);
	for(j = k - 1; j - i > 0; j--){
		strcpy(buf[ j+1 ], buf[ j ]);
	}
	strcpy(buf[i], s);
}

int main(){
	int N;
	scanf("%d", &N);
	char **buf;
	buf = (char **)malloc(sizeof(char *)*N);
	int i = 0, j = 0, k = 0, count = 0, index = 0;
	for(i = 0; i < N; i++){
		buf[i] = (char *)malloc(sizeof(char)*11);
	}
	char s[11];
	
	scanf("%s", buf[0]);
	k++; count++;
	
	for(i = 1; i < N; i++){
		scanf("%s", s);
		
		index = MeguruBinarySearch(buf, k, s);
		printf("%d\n", index);
		if(strcmp(buf[index], s) != 0){
			for(j = 0; j < k; j++){
				printf("buf[%d] = %s\n", j, buf[j]);
			}
			for(j = k - 1; j - index > 0; j--){
				strcpy(buf[ j+1 ], buf[ j ]);
			}
			strcpy(buf[ k ], s);
			k++;
			count++;
		}
	}
	printf("%d\n", count);
	return 0;
}