#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<ll, ll>P;

int main(){
  ll N;
  cin>>N;
  vector<P>Sup;
  vector<P>Sdown;
  rep(i,N){
  	string s;
  	cin>>s;
    ll total=0,mini=0;
    rep(j,s.size()){
      if(s[j]=='('){total++;}
      else{total--;}
      mini=min(mini,total);
    }
    if(total>=0){Sup.push_back(P(mini,total));}
    else{Sdown.push_back(P(mini-total,-total));}
  }
  sort(Sup.begin(),Sup.end());
  reverse(Sup.begin(),Sup.end());
  
  sort(Sdown.begin(),Sdown.end());
  reverse(Sdown.begin(),Sdown.end());
  
  int flag=0;
  ll sum1=0;
  ll sum2=0;
  rep(i,Sup.size()){
  	if(Sup[i].first<0&&sum1+Sup[i].first<0){flag=1;}
  	else{sum1+=Sup[i].second;}
    if(sum1<0){flag=1;}
  }
  rep(i,Sdown.size()){
  	if(Sdown[i].first<0&&sum2+Sdown[i].first<0){flag=1;}
  	else{sum2+=Sdown[i].second;}
    if(sum2<0){flag=1;}
  }
  if(sum1!=sum2){flag=1;}
  if(flag==1){cout<<"No";}
  if(flag==0){cout<<"Yes";}
}

#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 300005

char buf[SIZE];
int num_E[SIZE],num_W[SIZE];


int main(){

	int N;
	scanf("%d",&N);
	scanf("%s",buf);

	num_W[0] = 0;
	for(int i = 1; i <= N; i++){

		num_W[i] = num_W[i-1];
		if(buf[i-1] == 'W'){
			num_W[i]++;
		}
	}
	num_E[N+1] = 0;
	for(int i = N; i >= 1; i--){

		num_E[i] = num_E[i+1];
		if(buf[i-1] == 'E'){

			num_E[i]++;
		}
	}

	int ans = N;
	for(int i = 1; i <= N; i++){

		ans = min(ans,num_W[i-1]+num_E[i+1]);
	}

	printf("%d\n",ans);

	return 0;
}
