#include <bits/stdc++.h>
const int N = 100010;
const int inf = 0x3f3f3f3f;
using namespace std;
int n, cnt[3];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    cnt[x % 3]++;
  }
  int ret = cnt[0] / 2 + min(cnt[1], cnt[2]);
  cout << ret << endl;
  return 0;
}
