#include <bits/stdc++.h>
#pragma gcc optimize("ofast")
using namespace std;
long long modexp(long long a, long long b, long long m) {
  long long r = 1;
  a = a % m;
  while (b > 0) {
    if (b & 1) r = (r * a) % m;
    b >> 1;
    a = (a * a) % m;
  }
  return r % m;
}
int main() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long cnt = 0, flag = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(')
      cnt++;
    else {
      cnt--;
      if (cnt < -1) {
        flag = 1;
      }
    }
  }
  if (flag == 0 && cnt == 0)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
