#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int sum = 0;
  int wr = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '(')
      sum += 1;
    else
      sum -= 1;
    wr = min(wr, sum);
  }
  if (wr >= -1 && sum == 0)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
