#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, i, j, c = 0, d = 0, a, b, k = 0, sum = 0, sum1 = 0;
  cin >> t;
  string s;
  stack<char> st;
  cin >> s;
  for (i = 0; i < s.size(); i++) {
    if (s[i] == '(') {
      sum++;
    } else {
      sum1++;
    }
    if (s[i] == '(') {
      st.push(s[i]);
    } else if (s[i] == ')') {
      if (st.size() > 0 && st.top() == '(') {
        st.pop();
      } else {
        c++;
      }
    }
  }
  if (sum != sum1) {
    cout << "NO" << endl;
  } else if (st.size() <= 1 && c <= 1) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
