#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e6, N2 = 5e3, delta = 46639, mod = 1e9 + 7, oo = 1e16;
const long double PI = 3.141592653589793;
int main() {
  long long int n, cnt1 = 1, cnt2 = 1, mx = 0;
  string s;
  cin >> n >> s;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = i; j < n; j++) {
      string t = s;
      long long int cnt = 0, trn = 0, ans = 0;
      swap(t[i], t[j]);
      for (long long int k = 0; k < n; k++) {
        if (t[k] == '(')
          cnt++;
        else {
          if (cnt <= 0)
            trn++;
          else
            cnt--;
        }
      }
      for (long long int k = n - 1; k >= 0; k--) {
        if (cnt == 0 && trn == 0) ans++;
        if (t[k] == '(')
          cnt--, trn--;
        else
          cnt++, trn++;
      }
      mx = max(mx, ans);
      if (mx == ans) cnt1 = i + 1, cnt2 = j + 1;
    }
  }
  cout << mx << "\n" << cnt1 << ' ' << cnt2;
}
