#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
template <class T>
ostream& operator<<(ostream& os, vector<T> V) {
  os << "[ ";
  for (auto v : V) os << v << " ";
  return os << "]";
}
template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
const long long int mod = 1e9 + 7;
const long long int maxn = 5 * 100001;
const long long int INTMAX = 1e18;
long long int power(long long int x, long long int n) {
  long long int res = 1;
  for (; n > 0; n >>= 1) {
    if (n & 1) res = (res * x) % mod;
    x = (x * x) % mod;
  }
  return res;
}
long long int n, h;
long long int a[20], b[20];
long long int solve(long long int i, long long int a1, long long int b1) {
  if (i == n) {
    if (a1 >= h && b1 >= h)
      return 1;
    else {
      return 0;
    }
  }
  return (solve(i + 1, a1 + a[i], b1) + solve(i + 1, a1, b1 + b[i]) +
          solve(i + 1, a1 + a[i], b1 + b[i]));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  string s;
  cin >> s;
  long long int ans = 0;
  long long int l = 1, r = 1;
  long long int c = 0;
  for (auto x : s) {
    if (x == '(')
      c++;
    else {
      c--;
    }
  }
  if (c != 0) {
    cout << ans << endl << l << " " << r;
    return 0;
  }
  long long int pref[n + 1];
  pref[0] = 0;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = i; j < n; j++) {
      string t = s;
      long long int temp = 0;
      pref[0] = 0;
      swap(t[i], t[j]);
      long long int mini = n + 1;
      for (long long int k = 0; k < n; k++) {
        pref[k + 1] = pref[k] + (t[k] == '(' ? +1 : -1);
        mini = min(mini, pref[k + 1]);
      }
      for (long long int k = 0; k < n; k++) {
        temp += (pref[k + 1] == mini);
      }
      if (temp > ans) {
        ans = temp;
        l = i + 1;
        r = j + 1;
      }
    }
  }
  cout << ans << endl << l << " " << r << endl;
}
