diff --git a/ls.1 b/ls.1
index 00ae32b..d6f211e 100644
--- a/ls.1
+++ b/ls.1
@@ -14,6 +14,9 @@ are given the current directory is listed.
 .B \-a
 shows hidden files (those beginning with '.').
 .TP
+.B \-c
+show the number of files that would be printed.
+.TP
 .B \-d
 lists directories themselves, not their contents.
 .TP
diff --git a/ls.c b/ls.c
index f61d7c5..f740c4b 100644
--- a/ls.c
+++ b/ls.c
@@ -29,12 +29,14 @@ static void mkent(Entry *, char *, bool);
 static void output(Entry *);
 
 static bool aflag = false;
+static bool cflag = false;
 static bool dflag = false;
 static bool lflag = false;
 static bool tflag = false;
 static bool Uflag = false;
 static bool first = true;
 static bool many;
+static int entcount = 0;
 
 static void
 usage(void)
@@ -52,6 +54,9 @@ main(int argc, char *argv[])
 	case 'a':
 		aflag = true;
 		break;
+	case 'c':
+		cflag = true;
+		break;
 	case 'd':
 		dflag = true;
 		break;
@@ -79,6 +84,8 @@ main(int argc, char *argv[])
 	qsort(ents, argc, sizeof *ents, entcmp);
 	for(i = 0; i < argc; i++)
 		ls(&ents[i]);
+	if(cflag)
+		printf("%d\n", entcount);
 
 	return 0;
 }
@@ -129,6 +136,10 @@ lsdir(const char *path)
 	while((d = readdir(dp))) {
 		if(d->d_name[0] == '.' && !aflag)
 			continue;
+		if(cflag) {
+			entcount++;
+			continue;
+		}
 		if(Uflag){
 			mkent(&ent, d->d_name, lflag);
 			output(&ent);
