#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  string s;
  cin >> n >> s;
  long long mx = 0, l = 1, r = 1;
  for (long long i = 0; i < n; i++)
    for (long long j = i; j < n; j++) {
      string t = s;
      swap(t[i], t[j]);
      long long val[500] = {};
      val[0] = (t[0] == '(' ? 1 : -1);
      for (long long k = 1; k < n; k++)
        val[k] = val[k - 1] + (t[k] == '(' ? 1 : -1);
      if (val[n - 1]) continue;
      long long mn = 0;
      for (long long k = 0; k < n; k++) mn = min(mn, val[k]);
      long long cnt = 0;
      for (long long k = 0; k < n; k++) cnt += (val[k] == mn);
      if (cnt > mx) mx = cnt, l = i + 1, r = j + 1;
    }
  cout << mx << '\n' << l << ' ' << r << '\n';
  return 0;
}
