#include<iostream>
#include<string>
#include<cstring> // strlen()
#include<cstdio>
#include<iomanip>
using namespace std;
int main(){
int n, cnt = 0;
char a[50], b[50];
cin >> n;
double tmp = 0.0, sum = 0.0;
for(int i = 0; i < n; i++){
cin >> a;
// 使用sscanf将字符串转换为double形式
if(sscanf(a, "%lf", &tmp) != 1){
cout << "ERROR: " << a << " is not a legal number" << endl;
continue;
}
// 使用sprintf将tmp格式转换为两位小数
sprintf(b, "%.2f", tmp);
int flag = 0;
int len = strlen(a);
// 检查原始字符串和格式化后的字符串是否一致
for(int j = 0; j < len; j++){
if(a[j] != b[j]){
flag = 1;
break;
}
}
// 如果格式不一致或超出范围
if(flag != 0 || tmp < -1000 || tmp > 1000){
cout << "ERROR: " << a << " is not a legal number" << endl;
continue;
} else {
sum += tmp;
cnt++;
}
}
// 输出结果
if(cnt == 0){
cout << "The average of 0 numbers is Undefined" << endl;
} else if(cnt == 1){
cout << "The average of 1 number is "
<< fixed << setprecision(2) << sum << endl;
} else {
cout << "The average of " << cnt << " numbers is "
<< fixed << setprecision(2) << sum / cnt << endl;
}
return 0;
}