#include <bits/stdc++.h>
using namespace std;
map<string, int> record;
int main() {
  int n, m;
  vector<int> digit;
  vector<int> num;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int t = 0;
    scanf("%d", &m);
    while (m > 0) {
      t += m % 10;
      m /= 10;
    }
    if (t % 3 == 0)
      digit.push_back(t);
    else
      num.push_back(t);
  }
  int ans = digit.size() / 2;
  for (int i = 0; i < num.size(); i++) {
    for (int j = i + 1; j < num.size(); j++) {
      if ((num[i] + num[j]) % 3 == 0 && num[j] != 0) {
        ans++;
        num[j] = 0;
        break;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
