#include <bits/stdc++.h>
using namespace std;
const int N = 1;
int main() {
  long long int n;
  cin >> n;
  string s;
  cin >> s;
  long long int p = 0;
  for (int i = 0; i < n; i++)
    if (s[i] == '(')
      p++;
    else
      p--;
  if (p != 0) {
    cout << "NO";
    return 0;
  }
  long long int op = 0;
  bool es = 0;
  long long int o = -1;
  for (int i = 0; i < n; i++) {
    o = i;
    if (s[i] == '(')
      op++;
    else
      op--;
    if (op == -1) {
      break;
    }
  }
  if (o == n - 1) {
    cout << "YES";
    return 0;
  }
  op = 0;
  for (int i = o + 1; i < n; i++) {
    if (s[i] == '(')
      op++;
    else
      op--;
    if (op == -1) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
