#include <bits/stdc++.h>
using namespace std;
const int N = 1e4;
const int oo = 1e6;
int arr[N];
bool vis[N];
int main() {
  int n, ans = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", arr + i);
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++)
      if (i != j && (arr[i] + arr[j]) % 3 == 0 && !vis[i] && !vis[j])
        ans++, vis[i] = vis[j] = 1;
  printf("%d", ans);
}
