#include <bits/stdc++.h>
using namespace std;
const int OO = 1e9, N = 1e5;
int main() {
  long long n, c = 0, o = 0;
  cin >> n;
  string s;
  cin >> s;
  queue<int> q;
  for (int i = 0; i < n; i++) {
    o += (s[i] == '(');
    c += (s[i] == ')');
  }
  int sma7 = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == ')' && !q.empty())
      q.pop();
    else if (s[i] == ')')
      sma7++;
    else
      q.push(0);
  }
  if (o == c && sma7 <= 1)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
