#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long double ld;
typedef pair<ll, ll> pll;
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define ms memset
#define pb push_back
#define F first
#define S second
ll MOD = 1000000007;
ll INF = 1000000000;
 
ll power(ll base, ll n){
	if (n == 0) return 1;
	if (n == 1) return base;
	ll halfn = power(base, n/2);
	if (n % 2 == 0) return (halfn * halfn) % MOD;
	return (((halfn * halfn) % MOD) * base) % MOD;
}
 
ll inverse(ll n){
	return power(n, MOD-2);
}
 
ll add(ll a, ll b){
	return (a+b) % MOD;
}
 
ll mul(ll a, ll b){
	return (a*b) % MOD;
}
 
ll gcd(ll a, ll b){
	if (a == 0) return b;
	if (a == 1) return 1;
	return gcd(b%a, a);
}
 
int main(){
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vector<ll> a(n);
    FOR(i, 0, n){
    	cin >> a[i];
    	if (i % 2 == 1){
    		a[i] = 0 - a[i];
		}
	}
	vector<ll> A(n+1);
	map<ll, ll> mp;
	mp[0] = 1;
	ll ans = 0;
	FOR(i, 1, n+1){
		A[i] = A[i-1] + a[i-1];
		ans += mp[A[i]];
		mp[A[i]]++;
	}
	cout << ans << '\n';
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //int:2*10**9
typedef long double ld;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define vec2(name,i,j,k) vector<vector<ll>> name(i,vector<ll>(j,k))
#define vec3(name,i,j,k,l) vector<vector<vector<ll>>> name(i,vector<vector<ll>>(j,vector<ll>(k,l)))
#define pb push_back
#define MOD 1000000007 //998244353
#define PI 3.141592653
#define INF 100000000000000 //14
#define N 110000
//cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);


int main(){
  ll n; cin >> n;
  vector<string> s;
  vector<string> t;
  string x;
  REP(i,n){
    cin >> x;
    if (x[0]=='!') {
      x=x.erase(0,1);
      t.pb(x);
    }
    else {
      s.pb(x);
    }
  }
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  string ans = "satisfiable";
  REP(i,s.size()) {
    ll ind = lower_bound(t.begin(),t.end(),s[i])-t.begin();
    if (ind<t.size()) if (s[i]==t[ind]) {
      ans = t[ind];
      break;
    }
  }
  cout << ans << endl;
}