#include <bits/stdc++.h>
using namespace std;
long long t, n, m, k, x, y, z, a[500005], ans, val;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  string s;
  cin >> s;
  for (long long i = 0; i < n; i++) {
    if (s[i] == '(')
      x++;
    else
      x--;
    if (x == -1 && !z)
      x = 0, z = 1;
    else if (x == -1)
      break;
  }
  if (x == z)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
