#include <bits/stdc++.h>
using namespace std;
long long n, suma, minim, maxim, pos1, pos2;
long long v[300001];
char c;
long long nrok(long long v[300001]) {
  int ans = 0;
  suma = 0;
  minim = 600001;
  for (int j = 1; j <= n; j++) {
    suma += v[j];
    if (suma < minim) minim = suma;
  }
  if (minim >= 0) ans++;
  for (int j = n; j >= 2; j--) {
    minim += v[j];
    if (minim >= 0) ans++;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  minim = 6000001;
  for (int i = 1; i <= n; i++) {
    cin >> c;
    if (c == '(') v[i] = 1;
    if (c == ')') v[i] = -1;
    suma += v[i];
  }
  if (suma != 0) {
    cout << 0 << '\n';
    cout << 1 << " " << 1;
    return 0;
  }
  maxim = nrok(v);
  pos1 = 1;
  pos2 = 1;
  for (int i = 1; i < n; i++)
    for (int l = i + 1; l <= n; l++) {
      swap(v[i], v[l]);
      long long x = nrok(v);
      if (x > maxim) {
        maxim = x;
        pos1 = i;
        pos2 = l;
      }
      swap(v[i], v[l]);
    }
  cout << maxim << '\n' << pos1 << " " << pos2;
  return 0;
}
