#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, ans = 0, x = 0, y = 0;
  string s;
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(')
      ans++;
    else
      ans--;
  }
  if (ans != 0) {
    cout << "0\n1 1";
    return 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      char temp = s[i];
      s[i] = s[j];
      s[j] = temp;
      int c = 0, mx = 0, idx = -1, mn = INT_MAX;
      for (int k = 0; k < n; k++) {
        if (s[k] == '(')
          c++;
        else
          c--;
        if (c < mn) {
          mn = c;
          mx = 1;
        } else if (c == mn)
          mx++;
      }
      if (mx > ans) {
        ans = mx;
        x = i, y = j;
      }
      temp = s[i];
      s[i] = s[j];
      s[j] = temp;
    }
  }
  cout << ans << '\n';
  cout << x + 1 << " " << y + 1;
}
