#include <bits/stdc++.h>
using namespace std;
set<vector<char>> ans;
bool check(vector<char> &v) {
  vector<char> curr(6);
  curr[4] = v[0];
  curr[5] = v[2];
  curr[0] = v[5];
  curr[1] = v[1];
  curr[2] = v[4];
  curr[3] = v[3];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[0];
  curr[5] = v[2];
  curr[0] = v[1];
  curr[1] = v[4];
  curr[2] = v[3];
  curr[3] = v[5];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[0];
  curr[5] = v[2];
  curr[0] = v[4];
  curr[1] = v[3];
  curr[2] = v[5];
  curr[3] = v[1];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[0];
  curr[5] = v[2];
  curr[0] = v[3];
  curr[1] = v[5];
  curr[2] = v[1];
  curr[3] = v[4];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[1];
  curr[5] = v[3];
  curr[0] = v[0];
  curr[1] = v[5];
  curr[2] = v[2];
  curr[3] = v[4];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[1];
  curr[5] = v[3];
  curr[0] = v[5];
  curr[1] = v[2];
  curr[2] = v[4];
  curr[3] = v[0];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[1];
  curr[5] = v[3];
  curr[0] = v[2];
  curr[1] = v[4];
  curr[2] = v[0];
  curr[3] = v[5];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[1];
  curr[5] = v[3];
  curr[0] = v[4];
  curr[1] = v[0];
  curr[2] = v[5];
  curr[3] = v[2];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[2];
  curr[5] = v[0];
  curr[0] = v[4];
  curr[1] = v[1];
  curr[2] = v[5];
  curr[3] = v[3];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[2];
  curr[5] = v[0];
  curr[0] = v[1];
  curr[1] = v[5];
  curr[2] = v[3];
  curr[3] = v[4];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[2];
  curr[5] = v[0];
  curr[0] = v[5];
  curr[1] = v[3];
  curr[2] = v[4];
  curr[3] = v[1];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[2];
  curr[5] = v[0];
  curr[0] = v[3];
  curr[1] = v[4];
  curr[2] = v[1];
  curr[3] = v[5];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[3];
  curr[5] = v[1];
  curr[0] = v[0];
  curr[1] = v[4];
  curr[2] = v[2];
  curr[3] = v[5];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[3];
  curr[5] = v[1];
  curr[0] = v[4];
  curr[1] = v[2];
  curr[2] = v[5];
  curr[3] = v[0];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[3];
  curr[5] = v[1];
  curr[0] = v[2];
  curr[1] = v[5];
  curr[2] = v[0];
  curr[3] = v[4];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[3];
  curr[5] = v[1];
  curr[0] = v[5];
  curr[1] = v[0];
  curr[2] = v[4];
  curr[3] = v[2];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[4];
  curr[5] = v[5];
  curr[0] = v[0];
  curr[1] = v[1];
  curr[2] = v[2];
  curr[3] = v[3];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[4];
  curr[5] = v[5];
  curr[0] = v[1];
  curr[1] = v[2];
  curr[2] = v[3];
  curr[3] = v[0];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[4];
  curr[5] = v[5];
  curr[0] = v[2];
  curr[1] = v[3];
  curr[2] = v[0];
  curr[3] = v[1];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[4];
  curr[5] = v[5];
  curr[0] = v[3];
  curr[1] = v[0];
  curr[2] = v[1];
  curr[3] = v[2];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[5];
  curr[5] = v[4];
  curr[0] = v[2];
  curr[1] = v[1];
  curr[2] = v[0];
  curr[3] = v[3];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[5];
  curr[5] = v[4];
  curr[0] = v[1];
  curr[1] = v[0];
  curr[2] = v[3];
  curr[3] = v[2];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[5];
  curr[5] = v[4];
  curr[0] = v[0];
  curr[1] = v[3];
  curr[2] = v[2];
  curr[3] = v[1];
  if (ans.find(curr) != ans.end()) return false;
  curr[4] = v[5];
  curr[5] = v[4];
  curr[0] = v[3];
  curr[1] = v[2];
  curr[2] = v[1];
  curr[3] = v[0];
  if (ans.find(curr) != ans.end()) return false;
  return true;
}
int main() {
  vector<char> v(6);
  for (int i = 0; i < 6; i++) {
    cin >> v[i];
  }
  set<vector<char>> s;
  sort(v.begin(), v.end());
  do {
    if (check(v) == true) {
      ans.insert(v);
    }
  } while (next_permutation(v.begin(), v.end()));
  cout << ans.size();
  return 0;
}
