#include <bits/stdc++.h>
using namespace std;
const int N = 20000 * 100 + 20;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  if (n % 2) return cout << "NO", 0;
  int p = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(')
      p++;
    else
      p--;
    if (p < -1) return cout << "NO", 0;
  }
  if (!p)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
