#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string.h>
using namespace std;
//sscanf() – 從一個字元串中讀進與指定格式相符的資料
//sprintf() – 字元串格式化指令,主要功能是把格式化的資料寫入某個字元串中。
int main() {
int n, cnt = 0;
double sum = 0, t;
char a[50], b[50];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a;
sscanf(a, "%lf", &t);//從字元串中讀出
sprintf(b, "%.2lf", t);//寫入字元串
int flag = 0;
for (int j = 0; j < strlen(a); j++) {
if(a[j] != b[j]) flag = 1;
}
if(flag || t < -1000 || t > 1000) {
printf("ERROR: %s is not a legal number\n", a); continue;
}else{
sum += t;
cnt++;
}
}
if(cnt == 0) cout << "The average of 0 numbers is Undefined\n";
else if(cnt == 1) printf("The average of 1 number is %.2lf\n", sum);
else printf("The average of %d numbers is %.2lf\n", cnt, sum / cnt);
return 0;
}