#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  string s;
  cin >> n >> s;
  long long right = 0;
  long long left = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(') right++;
    if (s[i] == ')' && !right) left++;
    if (s[i] == ')' && right) right--;
  }
  if ((right + left) % 2 == 0 && right <= 1 && left <= 1)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
