#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using PLL = pair<LL, LL>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
template <class T>
using V = vector<T>;
template <class T>
using VV = vector<vector<T>>;
template <class T>
inline void IN(T &x) {
  x = 0;
  T f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  x *= f;
}
template <typename A, typename B>
inline void IN(A &x, B &y) {
  IN(x);
  IN(y);
}
template <typename A, typename B, typename C>
inline void IN(A &x, B &y, C &z) {
  IN(x);
  IN(y);
  IN(z);
}
template <class T>
void cout_1d(T &v) {
  for (auto &i : v) cout << i << " ";
  puts("");
}
template <class T>
void cout_2d(T &vv) {
  for (auto &v : vv) cout_1d(v);
}
const LD PI = acos(-1.0);
const LL MOD = 998244353;
const LL MAXN = 2e5 + 7;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int n;
  string s;
  cin >> n >> s;
  int l = 0, r = 0;
  for (int i = 0; i < s.size(); ++i) {
    char c = s[i];
    (c == '(') ? ++l : ++r;
    if (r > l + 1) {
      return puts("NO") && 0;
    }
  }
  puts(l == r ? "YES" : "NO");
  return 0;
}
