#include <bits/stdc++.h>
using namespace std;
int vis[10000000];
string tostring(int Number) {
  ostringstream ss;
  ss << Number;
  return ss.str();
}
int toint(string Text) {
  istringstream ss(Text);
  int result;
  return ss >> result ? result : 0;
}
int main() {
  int n, x, counter = 0, sum = 0, sum1 = 0, val;
  scanf("%d", &n);
  vector<int> vi;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    vi.push_back(x);
  }
  for (int i = 0; i < vi.size(); i++) {
    if (vis[i]) continue;
    sum = 0;
    val = vi[i];
    while (val) {
      sum += val % 10;
      val /= 10;
    }
    for (int j = i + 1; j < vi.size(); j++) {
      if (!vis[j] && !vis[i]) {
        val = vi[j];
        sum1 = 0;
        while (val) {
          sum1 += val % 10;
          val /= 10;
        }
        if ((sum + sum1) % 3 == 0) {
          counter++;
          vis[i] = 1;
          vis[j] = 1;
          break;
        }
      }
    }
  }
  printf("%d\n", counter);
  return 0;
}
