#include <bits/stdc++.h>
int main() {
  int n, i, flag = 0, sum1 = 0, sum2 = 0;
  char a[101];
  scanf("%d", &n);
  scanf("%s", a);
  if ((n % 2 != 0) || (n > 100))
    exit(0);
  else {
    for (i = 0; i <= (n - 1) / 2; i++) sum1 = sum1 + a[i];
    for (i = ((n - 1) / 2) + 1; i <= n - 1; i++) sum2 = sum2 + a[i];
  }
  for (i = 0; i <= n - 1; i++)
    if ((a[i] == 52) || (a[i] == 55))
      flag = 0;
    else {
      flag = 1;
      break;
    }
  if ((sum1 == sum2) && (flag == 0))
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
