Quickly done STL version (using your input loop) - untested - you probably would need to fix up the includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <map>
int main() {
unsigned n, x, size, mode=0;
freopen("mode.in", "rt", stdin);
scanf("%d\n", &n);
std::map<int,int> counts;
while (n--) {
scanf("%d\n", &x);
if (( size = ++counts[x]) )> mode) mode = size;
}
printf("%d\n", mode);
return 0;
}