#include <bits/stdc++.h>
using namespace std;
const long long N = 500005;
const long long mod = 1e9 + 7;
long long x = 1, y = 1, c = 0, ans = 0, l, r;
long long check(string s) {
  long long n = s.size(), p = 0, cnt = 0, cur = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(') {
      p++;
    } else {
      p--;
    }
    if (p == cur) {
      cnt++;
    } else if (p < cur) {
      cur = p;
      cnt = 1;
    }
  }
  return p == 0 ? cnt : 0;
}
void solve() {
  long long n, m, k;
  string s, t;
  cin >> n >> s;
  for (long long i = 0; i < n; ++i) {
    for (long long j = i + 1; j < n; ++j) {
      swap(s[i], s[j]);
      long long temp = check(s);
      if (temp > ans) {
        ans = temp, x = i + 1, y = j + 1;
      }
      swap(s[i], s[j]);
    }
  }
  cout << ans << '\n' << x << " " << y << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
