#include <bits/stdc++.h>
using namespace std;
long long n, pre[505][2], suf[505][2];
string s;
long long fun(string sq) {
  for (int i = 0; i < n; ++i) {
    long long open = (i == 0) ? 0 : pre[i - 1][0];
    long long close = (i == 0) ? 0 : pre[i - 1][1];
    if (sq[i] == '(') {
      pre[i][0] = 1 + open;
      pre[i][1] = close;
    } else {
      if (open) {
        pre[i][0] = open - 1;
        pre[i][1] = close;
      } else {
        pre[i][0] = open;
        pre[i][1] = close + 1;
      }
    }
  }
  for (int i = n - 1; i >= 0; --i) {
    long long close = (i == n - 1) ? 0 : suf[i + 1][1];
    long long open = (i == n - 1) ? 0 : suf[i + 1][0];
    if (sq[i] == ')') {
      suf[i][0] = open;
      suf[i][1] = close + 1;
    } else {
      if (close) {
        suf[i][0] = open;
        suf[i][1] = close - 1;
      } else {
        suf[i][0] = open + 1;
        suf[i][1] = close;
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    long long openp = (i == 0) ? 0 : pre[i - 1][0];
    long long closep = (i == 0) ? 0 : pre[i - 1][1];
    long long opens = suf[i][0];
    long long closes = suf[i][1];
    if (opens == closep && closes == 0 && openp == 0) ans++;
  }
  return ans;
}
int main(int argc, char const *argv[]) {
  long long bc = 0, l = 0, r = 0;
  cin >> n;
  cin >> s;
  for (int i = 0; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      swap(s[i], s[j]);
      long long c = fun(s);
      swap(s[i], s[j]);
      if (c > bc) {
        bc = c;
        l = i;
        r = j;
      }
    }
  }
  cout << bc << '\n';
  cout << l + 1 << ' ' << r + 1;
  return 0;
}
