#include <bits/stdc++.h>
using namespace std;
long int find_mod(string s) {
  long int i, x = 0;
  for (i = 0; i < s.length(); i++) x = (x * 10 + s[i] - '0') % 1000000007;
  return x;
}
long int prime[10000001 + 1];
void sieve1() {
  for (int i = 0; i <= 10000001; i++) prime[i] = 1;
  prime[0] = prime[1] = 0;
  for (long int i = 4; i <= 10000001; i += 2) prime[i] = 0;
  for (int p = 3; p * p <= 10000001; p += 2) {
    if (prime[p] == 1)
      for (int i = p * 2; i <= 10000001; i += p) {
        prime[i] = 0;
      }
  }
}
int min_prime_div_of_n[10000001 + 1];
void sieve2() {
  memset(min_prime_div_of_n, 0, sizeof(min_prime_div_of_n));
  min_prime_div_of_n[0] = min_prime_div_of_n[1] = 1;
  for (int i = 2; i * i <= 10000001; i++) {
    if (min_prime_div_of_n[i] == 0) {
      for (int j = i * 2; j < 10000001; j += i) {
        if (min_prime_div_of_n[j] == 0) {
          min_prime_div_of_n[j] = i;
        }
      }
    }
  }
  for (int i = 2; i <= 10000001; i++)
    if (min_prime_div_of_n[i] == 0) min_prime_div_of_n[i] = i;
}
int max_prime_div_of_n[10000001 + 1];
void sieve3() {
  sieve1();
  memset(max_prime_div_of_n, 0, sizeof(max_prime_div_of_n));
  max_prime_div_of_n[0] = max_prime_div_of_n[1] = 1;
  for (int i = 2; i * i <= 10000001; i++) {
    if (max_prime_div_of_n[i] == 0) {
      for (int j = i * 2; j < 10000001; j += i) {
        if (max_prime_div_of_n[j] == 0 || ((j % i) == 0 && prime[i] == 1)) {
          max_prime_div_of_n[j] = i;
        }
      }
    }
  }
  for (int i = 2; i <= 100; i++)
    if (max_prime_div_of_n[i] == 0) max_prime_div_of_n[i] = i;
}
long int sum_prime_fac[1000001];
void sieve4() {
  sum_prime_fac[1000001] = {0};
  for (long int i = 2; i <= 1000000; i++) {
    if (!sum_prime_fac[i]) {
      for (long int j = i; j <= 1000000; j += i) sum_prime_fac[j] += i;
    }
  }
}
bool is_even(long int n) { return (n % 2 == 0); }
bool is_odd(long int n) { return (n % 2 == 1); }
long int sum(long int n) {
  long int sum = 0;
  while (n) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
bool isPrime(long int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n == 5) return true;
  if ((n % 2 == 0) || (n % 3 == 0) || (n % 5 == 0)) return false;
  for (long int i = 5; i * i <= n; i += 6)
    if ((n % i == 0) || (n % (i + 2) == 0)) return false;
  return true;
}
long int reversenum(long int x) {
  long int num = 0;
  while (x > 0) {
    num = num * 10 + x % 10;
    x = x / 10;
  }
  return num;
}
bool ispalindrome(string s) {
  string q = s;
  reverse(q.begin(), q.end());
  return (s == q);
}
bool isvowel(char x) {
  return (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u');
}
long int sumarr(long int a[], long int n) {
  long int sum = 0;
  for (long int i = 0; i < n; i++) sum += a[i];
  return sum;
}
long long mulmod(long long a, long long b) {
  return ((a % 1000000007) * (b % 1000000007)) % 1000000007;
}
long long modadd(long long a, long long b) {
  return ((a % 1000000007) + (b % 1000000007)) % 1000000007;
}
long long modsub(long long a, long long b) {
  return ((a % 1000000007) - (b % 1000000007) + 1000000007) % 1000000007;
}
long int fastexpo(long int a, long int b) {
  a = a % 1000000007;
  long int ans = 1;
  while (b) {
    if (b % 2) ans = (ans * 1ll * a) % 1000000007;
    a = (a * 1ll * a) % 1000000007;
    b = b / 2;
  }
  return ans;
}
long int findmax(long int a[], long int x, long int y) {
  long int maxi = -1;
  for (long int i = x; i <= y; i++) {
    maxi = max(maxi, a[i]);
  }
  return maxi;
}
long int phi[10000001];
void euler_phi() {
  for (long int i = 0; i < 10000001 - 1; i++) phi[i + 1] = i + 1;
  for (long int p = 2; p < 10000001; p++) {
    if (phi[p] == p) {
      phi[p] = p - 1;
      for (long int i = 2 * p; i < 10000001; i += p)
        phi[i] = (phi[i] / p) * (p - 1);
    }
  }
}
void prime_factorise(long int n, map<long int, long int> &mp) {
  while (n % 2 == 0) {
    mp[2]++;
    n /= 2;
  }
  for (long int i = 3; i * i <= n; i += 2) {
    while (n % i == 0) {
      mp[i]++;
      n /= i;
    }
  }
  if (n > 1) mp[n]++;
}
long int largestPower(long int n, long int p) {
  long int total = 0;
  while (n) {
    n /= p;
    total += n;
  }
  return total;
}
long double dist_bet_points(long double x0, long double y0, long double x1,
                            long double y1) {
  return (sqrt(((x1 - x0) * (x1 - x0)) + ((y1 - y0) * (y1 - y0))));
}
bool iscontainzero(long int n) {
  while (n) {
    if (n % 10 == 0) return true;
    n /= 10;
  }
  return false;
}
long int sqsumdigi(long int n) {
  long int sum = 0;
  while (n) {
    sum = sum + (n % 10) * (n % 10);
    n /= 10;
  }
  return sum;
}
bool issq(long int n) {
  if (int(sqrt(n)) == sqrt(n)) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long int t = 1;
  while (t--) {
    long int n;
    cin >> n;
    long int a[n];
    for (long int i = 0; i < n; i++) cin >> a[i];
    ;
    long long sum = 0;
    for (long int i = 0; i < 62; i++) {
      long int z = 0;
      long int o = 0;
      long long crsum = 0;
      for (long int j = 0; j < n; j++) {
        if (a[j] % 2 == 0)
          z++;
        else
          o++;
        a[j] = a[j] / 2;
      }
      crsum = mulmod(mulmod(o, z), (1 << i));
      sum = (sum % 1000000007 + crsum % 1000000007) % 1000000007;
    }
    cout << sum % 1000000007 << '\n';
    ;
  }
  return 0;
}
