#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, c = 0, tag = true;
  cin >> n;
  char a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) {
    if (a[i] == '(') c++;
    if (a[i] == ')') c--;
    if (c < -1) {
      tag = false;
      break;
    }
  }
  if (c == 0 && tag == true)
    cout << "YES";
  else
    cout << "NO";
}
