#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
const int mod = 1e9 + 7;
const int B = 317;
int n;
int mx;
int l, r;
string s;
int foo() {
  int x = 0;
  int y = 0;
  int mn = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(')
      x++;
    else
      x--;
    if (x < mn) {
      mn = x;
      y = 0;
    }
    if (x == mn) y++;
  }
  return y;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s;
  int x = 0;
  int y = 0;
  for (int i = 0; i < n; i++)
    if (s[i] == '(')
      x++;
    else
      y++;
  if (x != y) {
    cout << 0 << "\n" << 1 << " " << 1;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      swap(s[i], s[j]);
      int x = foo();
      if (x > mx) {
        mx = x;
        l = i;
        r = j;
      }
      swap(s[i], s[j]);
    }
  }
  cout << mx << "\n" << l + 1 << " " << r + 1;
}
