#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 9;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int mx = 0, ml = 0, mr = 0;
  for (int i = (int)(0); i < (int)(n); ++i) {
    for (int j = (int)(i); j < (int)(n); ++j) {
      swap(s[i], s[j]);
      int cnt = 0, ans = 0, mi = 0;
      for (auto ix : s) {
        if (ix == ')')
          --cnt;
        else
          ++cnt;
        mi = min(mi, cnt);
      }
      cnt = 0;
      for (auto ix : s) {
        if (ix == ')')
          --cnt;
        else
          ++cnt;
        ans += (cnt == mi);
      }
      if (cnt == 0 && mx < ans) mx = ans, ml = i, mr = j;
      swap(s[i], s[j]);
    }
  }
  cout << mx << '\n' << ml + 1 << ' ' << mr + 1;
  return 0;
}
