#include <bits/stdc++.h>
using namespace std;
const int LIM = 1e5 + 5, MOD = 1e9 + 7;
int main() {
  long long i, j, k, m, n, pos;
  cin >> n;
  string s;
  cin >> s;
  long long ob = 0, cb = 0;
  int flag = 1;
  long long cnt = 0, cnt2;
  long long res = 0;
  long long a = 0, b = 0;
  char c;
  for (int i = 0; i < n; ++i) {
    for (j = i; j < n; j++) {
      c = s[i];
      s[i] = s[j];
      s[j] = c;
      flag = 1;
      m = n;
      for (int k = 0; k < n; ++k) {
        if (s[k] == '(')
          cnt++;
        else
          cnt--;
        if (cnt < m) m = cnt;
      }
      if (cnt != 0) continue;
      cnt = 0;
      cnt2 = 0;
      for (int k = 0; k < n; ++k) {
        if (s[k] == '(')
          cnt++;
        else
          cnt--;
        if (cnt == m) cnt2++;
      }
      if (cnt2 > res) {
        a = i;
        b = j;
        res = cnt2;
      }
      c = s[i];
      s[i] = s[j];
      s[j] = c;
    }
  }
  cout << res << "\n";
  if (a > b) {
    m = a;
    a = b;
    b = m;
  }
  a++;
  b++;
  cout << a << " " << b << "\n";
  return 0;
}
