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