#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define pri_que priority_queue
#define vint vector<int>
#define vvint vector<vector<int>>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vvc vector<vector<char>>
#define vc vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e15;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int n; cin >> n;
    vi a(n);
    rep(i,n)cin >> a[i];

    int res1=0,res3=-1*INF;
    ld res2=0.0;

    rep(i,n) res1+=abs(a[i]);
    rep(i,n) res2+=a[i]*a[i]; res2=sqrt(res2);
    rep(i,n) res3=max(res3,abs(a[i]));
    cout<<res1<<endl<<res2<<endl<<res3<<endl;
}
#include <bits/stdc++.h>
using namespace std;
using INT = long long int;
using VINT = vector<INT>;
using VVINT = vector<VINT>;
using DBL = long double;
const int BX = 1;
INT N, M;
map<INT, VINT> E;
void init() {
    cin >> N >> M;
    for ( INT ix = 0 + BX; ix < M + BX; ix++ ) {
        INT a, b;
        cin >> a >> b;
        E[ a ].push_back( b );
    }
}
void dfs( const INT id, set<INT>& visited ) {
    if ( visited.count( id ) > 0 ) {
        return;
    }
    visited.insert( id );
    for ( auto it = E[ id ].cbegin(); it != E[ id ].cend(); it++ ) {
        dfs( *it, visited );
    }
}
void kick() {
    init();
    INT res = 0;
    for ( INT id = 0 + BX; id < N + BX; id++ ) {
        set<INT> visited;
        dfs( id, visited );
        res += visited.size();
    }
    cout << res << endl;
}
int main() {
    kick();
    return 0;
}
