#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
    ll N;
    cin>>N;
    v A(N);
    v sA(N,0),ssA(N,0);
    rep(i,0,N){
        cin>>A[i];
        if(i==0){sA[0]=A[0];ssA[0]=A[0]*A[0];}
        else{
            sA[i] = sA[i-1]+A[i];
            ssA[i]= ssA[i-1]+A[i]*A[i];
        }
    }
    ll ans = 0;
    rep(i,2,N+1){
        ans += (i-1)*A[i-1]*A[i-1]-2*A[i-1]*sA[i-2]+ssA[i-2];
    }
    cout<<ans;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

int main() {
	
	string s;
	cin >> s;
	int cnt = 0;
	for(int i = 0; i < (int) s.size() - 4 + 1; ++i) {
		string t = "";
		for(int j = i; j < (int) i + 4; ++j) {
			t += s[j];
		}
		//cout << t << "\n";
		if(t == "ZONe") {
			++cnt;
		}
	}
	cout << cnt << '\n';
	
}
