#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int freq[3] = {0};
  for (long long int i = 0; i < n; i++) {
    long long int a;
    cin >> a;
    freq[a % 3]++;
  }
  long long int tickets0 = freq[0] / 2;
  long long int tickets12 = min(freq[1], freq[2]);
  cout << tickets0 + tickets12 << endl;
}
