#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  string s;
  int rect = 0;
  int dia = 0;
  while (cin >> s) {
    a = s[0] - '0';
    b = s[2] - '0';
    if (a == b)
      dia++;
    else
      rect++;
  }
  cout << rect << endl << dia << endl;
  return 0;
}
