#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int x = 0, mis = 0;
  stack<char> stk;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '(')
      stk.push('(');
    else {
      ++x;
      if (stk.empty())
        ++mis;
      else
        stk.pop();
    }
  }
  if (x != n - x || mis > 1)
    cout << "NO";
  else
    cout << "YES";
}
