#include <bits/stdc++.h>
using namespace std;

#define rep(dsa,kajo) for (int dsa = 0; dsa < (kajo); ++dsa)
using ll = long long;
using P = pair<int,int>;
void chmin(int& w, int z){w = min(w,z);}
void chmax(int& w, int z){w = max(w,z);}

int main() {
  int kajo;
  cin >> kajo;
  vector<ll> a(410,0);
  rep(dsa,kajo) {
    ll w;
    cin >> w;
    w += 202;
    a[w] += 1;
  }
  ll qsa = 0;
  rep(dsa, 410) rep(pop,dsa){
    if(dsa==pop) continue;
    qsa += (ll)(dsa-pop) * (ll)(dsa-pop) * a[dsa] * a[pop];
  }
  cout << qsa << endl;
  return 0;
}
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <map> //http://vivi.dyndns.org/tech/cpp/map.html
#include <set> //http://vivi.dyndns.org/tech/cpp/set.html
#include <vector>
#include <deque>
#include <queue>
#include <numeric> //gcd,lcm c++17
#include <tuple>
#include <iomanip> //setprecision
#include <unordered_map>
#include <chrono>
using namespace std;
template <typename T>
using vc = vector<T>;
template <typename T>
using vv = vc<vc<T>>;
template <typename T>
using PQ = priority_queue<T, vc<T>, greater<T>>;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
//typedef __uint128_t Int;
using vi = vc<int>;
using vl = vc<ll>;
using vd = vc<double>;
#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define ALL(a) (a).begin(), (a).end()
#define sz(x) (int)(x).size()
template <class T1, class T2, class Pred = std::less<T2>>
struct sort_pair_second
{
    //sort_pair_second<ll,ll,greater<ll>>()
    bool operator()(const std::pair<T1, T2> &left, const std::pair<T1, T2> &right)
    {
        Pred p;
        return p(left.second, right.second);
    }
};
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
int MOD = 1e9 + 7;
double EPS = 1e-9;
int INF = 2000000005;
long long INFF = 1000000000000000005LL;
double PI = acos(-1);
int dirx[8] = {-1, 0, 0, 1, -1, -1, 1, 1};
int diry[8] = {0, 1, -1, 0, -1, 1, -1, 1};
int rdx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int rdy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main()
{
    ll N;
    cin >> N;
    ll ans = (1LL << (N + 1));
    string S[N];
    FOR(i, 0, N) { cin >> S[i]; };
    ll r = 0;
    vv<ll> dp(61, vc<ll>(2, 0));
    dp[0][0] = 1;
    dp[0][1] = 1;
    FOR(i, 1, N + 1)
    {
        FOR(j, 0, 2)
        {
            if (j == 0)
            {
                if (S[i - 1] == "AND")
                {
                    dp[i][j] += dp[i - 1][0];
                    dp[i][1] += dp[i - 1][1];
                }
                else
                {
                    dp[i][j] += dp[i - 1][1] + dp[i - 1][0];
                }
            }
            else
            {
                if (S[i - 1] == "AND")
                {
                    dp[i][j] += dp[i - 1][j - 1] + dp[i - 1][j];
                }
                else
                {
                    dp[i][0] += dp[i - 1][0];
                    dp[i][1] += dp[i - 1][1];
                }
            }
        }
    }
    cout << dp[N][0] << endl;
}