#include <bits/stdc++.h>
using namespace std;
const int mxn = 1e5 + 1;
int sum(int n) {
  int ans = 0;
  while (n) {
    ans += n % 10;
    n /= 10;
  }
  return ans % 3;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    int n, i, arr[3] = {0};
    cin >> n;
    for (i = 0; i < n; i++) {
      int x;
      cin >> x;
      arr[sum(x)]++;
    }
    long long ans = arr[0] / 2 + min(arr[1], arr[2]);
    cout << ans;
  }
  return 0;
}
