#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string str;
  cin >> str;
  if (n % 2 != 0) {
    cout << "NO" << endl;
  } else {
    stack<char> s;
    int c = 0, x = 0, y = 0;
    for (int i = 0; i < n; i++) {
      if (s.empty()) {
        if (str[i] == ')') {
          c++;
        } else {
          s.push('(');
        }
      } else {
        if (str[i] == '(')
          s.push('(');
        else
          s.pop();
      }
      if (str[i] == '(')
        x++;
      else
        y++;
    }
    if (c > 1) {
      cout << "NO" << endl;
      return 0;
    } else {
      if (c == 1 && s.size() == 1) {
        cout << "YES" << endl;
      } else {
        if (s.size() == 0) {
          cout << "YES" << endl;
        } else {
          cout << "NO" << endl;
        }
      }
    }
  }
  return 0;
}
