#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
using namespace std;
const long long maxn = 1e6 + 100, inf = 1e9, LOG = 23, mod = 1e9 + 7;
int block = 300, timer = 0;
const long double EPS = 1e-7;
int n, bal;
char ch[maxn];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> ch[i];
    bal += (ch[i] == '(');
    bal -= (ch[i] == ')');
  }
  if (bal != 0) {
    cout << "NO";
    return 0;
  }
  int pl = 0;
  for (int i = 1; i <= n; ++i) {
    bal += (ch[i] == '(');
    bal -= (ch[i] == ')');
    if (bal < 0) {
      bal++;
      n++;
      ch[n] = ch[i];
      pl = i;
      break;
    }
  }
  bal = 0;
  for (int i = 1; i <= n; ++i) {
    if (i == pl) continue;
    bal += (ch[i] == '(');
    bal -= (ch[i] == ')');
    if (bal < 0) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
