
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
int main() {
int N, K = 0;
double sum = 0.0, temp = 0.0;
char num[9], str[9], c;
scanf("%d", &N);
for (int i = 0; i < N; i++) {
scanf("%8s", str);
c = ungetc(getchar(), stdin);
int len = strlen(str), isLegal = 0;
if (isspace(c)) {
isLegal = 1;
sscanf(str, "%lf", &temp);
sprintf(num, "%.2f", temp);
for (int j = 0; j < len; j++) {
if (num[j] != str[j]) {
isLegal = 0;
break;
}
}
}
if (!isLegal || temp > 1000 || temp < -1000) {
printf("ERROR: %s", str);
while (!isspace(c = getchar())) {
putchar(c);
}
printf(" is not a legal number\n");
} else {
sum += temp;
K++;
}
}
if (K == 0) {
printf("The average of 0 numbers is Undefined\n");
} else if (K == 1) {
printf("The average of 1 number is %.2f\n", sum);
} else {
printf("The average of %d numbers is %.2f\n", K, sum / K);
}
return 0;
}