#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)


int main()
{
	char num[10];
	rep(i, 10)
	{
		cin >> num[i];
	}
	int ans = 0;
	rep(i, 10000)
	{
		int tmp = i;
		bool b[10] = { false };
		rep(j, 4)
		{
			int k = tmp % 10;
			b[k] = true;
			tmp /= 10;
		}
		bool flag = true;
		rep(j, 10)
		{
			if (b[j] && num[j] == 'x')
			{
				flag = false;
				break;
			}
			if (!b[j] && num[j] == 'o')
			{
				flag = false;
				break;
			}
		}
		if (flag) ans++;

	}
	cout << ans;
	return 0;
}
#include <algorithm>
#include <iostream>

using namespace std;

const int A = 200;

int kk[A + A + 1];

int main() {
	int n; cin >> n;
	long long ans = 0;
	while (n--) {
		int a; cin >> a, a += A;
		for (int b = 0; b <= A + A; b++)
			ans += (long long) ((a - A) - (b - A)) * ((a - A) - (b - A)) * kk[b];
		kk[a]++;
	}
	cout << ans << '\n';
	return 0;
}
