#include <bits/stdc++.h>
using namespace std;
const int maxn = 11000;
char c[10000];
int vis[maxn];
int num[maxn];
int main() {
  int n, v;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%s", c);
    int len = strlen(c);
    for (int j = 0; j < len; j++) {
      num[i] += c[j] - '0';
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i != j && !vis[i] && !vis[j] && (num[i] + num[j]) % 3 == 0) {
        vis[i] = 1;
        vis[j] = 1;
        ans++;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
