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