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