#include <bits/stdc++.h>
using namespace std;
struct Number {
  char str[10];
  int sum;
} a[12345];
bool vis[12345];
int n;
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; i++) {
      scanf("%s", a[i].str);
      a[i].sum = 0;
      int len = strlen(a[i].str);
      for (int j = 0; j < len; j++) {
        a[i].sum += a[i].str[j] - '0';
      }
    }
    memset(vis, true, sizeof(vis));
    bool find = false;
    int ans = 0;
    for (int i = 0; i < n - 1; i++) {
      if (vis[i] == false) continue;
      for (int j = i + 1; j < n; j++) {
        if (vis[j] == false) continue;
        if ((a[i].sum + a[j].sum) % 3 == 0) {
          ans++;
          vis[i] = false;
          vis[j] = false;
          find = true;
          break;
        }
      }
      if (find) continue;
    }
    printf("%d\n", ans);
  }
  return 0;
}
