#include<iostream>#include<string>usingnamespace std;intmain(){int num;
cin >> num;int err_cnt =0;double total =0.0;for(int i =0;i < num;i ++){
string tmp;
cin >> tmp;int j =0,pos =-1;for(;j < tmp.length();j ++){if(j ==0&& tmp[j]=='-')continue;if((tmp[j]<'0'|| tmp[j]>'9')&& tmp[j]!='.'){
cout <<"ERROR: "+ tmp +" is not a legal number\n";
err_cnt ++;break;}if(pos ==-1&& tmp[j]=='.') pos = j;}if(j != tmp.length())continue;if(pos !=-1&& tmp.length()- pos >3){
cout <<"ERROR: "+ tmp +" is not a legal number\n";
err_cnt ++;continue;}double val =stod(tmp);if(val <-1000|| val >1000){
cout <<"ERROR: "+ tmp +" is not a legal number\n";
err_cnt ++;continue;}
total += val;}if(num - err_cnt ==1)printf("The average of 1 number is %.2lf",total);elseif(num - err_cnt)printf("The average of %d numbers is %.2lf",num - err_cnt,total /(num - err_cnt));elseprintf("The average of 0 numbers is Undefined");return0;}