#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int b = 0, r = 0;
  for (int(i) = 0; (i) < (s.size()); (i)++) {
    if (s[i] == '0')
      r++;
    else
      b++;
  }
  int ansk = min(b, r);
  int ans = ansk * ansk;
  cout << ans << endl;
}
